Showing error 1745

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/scsi/sg.c
Line in file: 2496
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 20:24:52 UTC


Source:

2466        struct sg_proc_deviter * it = (struct sg_proc_deviter *) v;
2467        Sg_device *sdp;
2468        struct scsi_device *scsidp;
2469
2470        sdp = it ? sg_get_dev(it->index) : NULL;
2471        if (sdp && (scsidp = sdp->device) && (!sdp->detached))
2472                seq_printf(s, "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
2473                              scsidp->host->host_no, scsidp->channel,
2474                              scsidp->id, scsidp->lun, (int) scsidp->type,
2475                              1,
2476                              (int) scsidp->queue_depth,
2477                              (int) scsidp->device_busy,
2478                              (int) scsi_device_online(scsidp));
2479        else
2480                seq_printf(s, "-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\n");
2481        return 0;
2482}
2483
2484static int sg_proc_open_devstrs(struct inode *inode, struct file *file)
2485{
2486        return seq_open(file, &devstrs_seq_ops);
2487}
2488
2489static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v)
2490{
2491        struct sg_proc_deviter * it = (struct sg_proc_deviter *) v;
2492        Sg_device *sdp;
2493        struct scsi_device *scsidp;
2494
2495        sdp = it ? sg_get_dev(it->index) : NULL;
2496        if (sdp && (scsidp = sdp->device) && (!sdp->detached))
2497                seq_printf(s, "%8.8s\t%16.16s\t%4.4s\n",
2498                           scsidp->vendor, scsidp->model, scsidp->rev);
2499        else
2500                seq_printf(s, "<no active device>\n");
2501        return 0;
2502}
2503
2504static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp)
2505{
2506        int k, m, new_interface, blen, usg;
Show full sources