Showing error 1640

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-hdw.c
Line in file: 2566
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 07:54:05 UTC


Source:

2536
2537// Calculate correct set of enumerated standards based on currently known
2538// set of available standards bits.
2539static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw)
2540{
2541        struct v4l2_standard *newstd;
2542        unsigned int std_cnt;
2543        unsigned int idx;
2544
2545        newstd = pvr2_std_create_enum(&std_cnt,hdw->std_mask_avail);
2546
2547        if (hdw->std_defs) {
2548                kfree(hdw->std_defs);
2549                hdw->std_defs = NULL;
2550        }
2551        hdw->std_enum_cnt = 0;
2552        if (hdw->std_enum_names) {
2553                kfree(hdw->std_enum_names);
2554                hdw->std_enum_names = NULL;
2555        }
2556
2557        if (!std_cnt) {
2558                pvr2_trace(
2559                        PVR2_TRACE_ERROR_LEGS,
2560                        "WARNING: Failed to identify any viable standards");
2561        }
2562        hdw->std_enum_names = kmalloc(sizeof(char *)*(std_cnt+1),GFP_KERNEL);
2563        hdw->std_enum_names[0] = "none";
2564        for (idx = 0; idx < std_cnt; idx++) {
2565                hdw->std_enum_names[idx+1] =
2566                        newstd[idx].name;
2567        }
2568        // Set up the dynamic control for this standard
2569        hdw->std_info_enum.def.type_enum.value_names = hdw->std_enum_names;
2570        hdw->std_info_enum.def.type_enum.count = std_cnt+1;
2571        hdw->std_defs = newstd;
2572        hdw->std_enum_cnt = std_cnt+1;
2573        hdw->std_enum_cur = 0;
2574        hdw->std_info_cur.def.type_bitmask.valid_bits = hdw->std_mask_avail;
2575}
2576
Show full sources