Showing error 750

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/media/video/pvrusb2/pvrusb2-std.c
Line in file: 373
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Smatch (1.59)
Entered: 2011-11-07 22:22:22 UTC


Source:

343                if (match_std(idmsk)) {
344                        std_cnt++;
345                        continue;
346                }
347                fmsk |= idmsk;
348        }
349
350        for (idx2 = 0; idx2 < ARRAY_SIZE(std_mixes); idx2++) {
351                if ((id & std_mixes[idx2]) == std_mixes[idx2]) std_cnt++;
352        }
353
354        /* Don't complain about ATSC standard values */
355        fmsk &= ~CSTD_ATSC;
356
357        if (fmsk) {
358                char buf[100];
359                bcnt = pvr2_std_id_to_str(buf,sizeof(buf),fmsk);
360                pvr2_trace(
361                        PVR2_TRACE_ERROR_LEGS,
362                        "WARNING:"
363                        " Failed to classify the following standard(s): %.*s",
364                        bcnt,buf);
365        }
366
367        pvr2_trace(PVR2_TRACE_STD,"Setting up %u unique standard(s)",
368                   std_cnt);
369        if (!std_cnt) return NULL; // paranoia
370
371        stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt,
372                          GFP_KERNEL);
373        for (idx = 0; idx < std_cnt; idx++) stddefs[idx].index = idx;
374
375        idx = 0;
376
377        /* Enumerate potential special cases */
378        for (idx2 = 0; (idx2 < ARRAY_SIZE(std_mixes)) && (idx < std_cnt);
379             idx2++) {
380                if (!(id & std_mixes[idx2])) continue;
381                if (pvr2_std_fill(stddefs+idx,std_mixes[idx2])) idx++;
382        }
383        /* Now enumerate individual pieces */
Show full sources