Showing error 1810

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: 3354
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

3324
3325        /* Ensure that we have sane parameters */
3326        if (!write_data) write_len = 0;
3327        if (!read_data) read_len = 0;
3328        if (write_len > PVR2_CTL_BUFFSIZE) {
3329                pvr2_trace(
3330                        PVR2_TRACE_ERROR_LEGS,
3331                        "Attempted to execute %d byte"
3332                        " control-write transfer (limit=%d)",
3333                        write_len,PVR2_CTL_BUFFSIZE);
3334                return -EINVAL;
3335        }
3336        if (read_len > PVR2_CTL_BUFFSIZE) {
3337                pvr2_trace(
3338                        PVR2_TRACE_ERROR_LEGS,
3339                        "Attempted to execute %d byte"
3340                        " control-read transfer (limit=%d)",
3341                        write_len,PVR2_CTL_BUFFSIZE);
3342                return -EINVAL;
3343        }
3344        if ((!write_len) && (!read_len)) {
3345                pvr2_trace(
3346                        PVR2_TRACE_ERROR_LEGS,
3347                        "Attempted to execute null control transfer?");
3348                return -EINVAL;
3349        }
3350
3351
3352        hdw->cmd_debug_state = 1;
3353        if (write_len) {
3354                hdw->cmd_debug_code = ((unsigned char *)write_data)[0];
3355        } else {
3356                hdw->cmd_debug_code = 0;
3357        }
3358        hdw->cmd_debug_write_len = write_len;
3359        hdw->cmd_debug_read_len = read_len;
3360
3361        /* Initialize common stuff */
3362        init_completion(&hdw->ctl_done);
3363        hdw->ctl_timeout_flag = 0;
3364        hdw->ctl_write_pend_flag = 0;
Show full sources