Showing error 1682

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: sound/usb/usbaudio.c
Line in file: 1870
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 07:54:05 UTC


Source:

1840        return err;
1841}
1842
1843/*
1844 *  If the device supports unusual bit rates, does the request meet these?
1845 */
1846static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime,
1847                                  struct snd_usb_substream *subs)
1848{
1849        struct audioformat *fp;
1850        int count = 0, needs_knot = 0;
1851        int err;
1852
1853        list_for_each_entry(fp, &subs->fmt_list, list) {
1854                if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS)
1855                        return 0;
1856                count += fp->nr_rates;
1857                if (fp->rates & SNDRV_PCM_RATE_KNOT)
1858                        needs_knot = 1;
1859        }
1860        if (!needs_knot)
1861                return 0;
1862
1863        subs->rate_list.count = count;
1864        subs->rate_list.list = kmalloc(sizeof(int) * count, GFP_KERNEL);
1865        subs->rate_list.mask = 0;
1866        count = 0;
1867        list_for_each_entry(fp, &subs->fmt_list, list) {
1868                int i;
1869                for (i = 0; i < fp->nr_rates; i++)
1870                        subs->rate_list.list[count++] = fp->rate_table[i];
1871        }
1872        err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
1873                                         &subs->rate_list);
1874        if (err < 0)
1875                return err;
1876
1877        return 0;
1878}
1879
1880
Show full sources