Showing error 1648

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


Source:

 342                        continue;
 343                if (NULL == vendor_labels[i])
 344                        continue;
 345                ch->firsts[CHET_V1+i] = vendor_firsts[i];
 346                ch->counts[CHET_V1+i] = vendor_counts[i];
 347                vprintk("type #%d (v%d): 0x%x+%d [%s, vendor specific]\n",
 348                        i+5,i+1,vendor_firsts[i],vendor_counts[i],
 349                        vendor_labels[i]);
 350        }
 351
 352        /* look up the devices of the data transfer elements */
 353        ch->dt = kmalloc(ch->counts[CHET_DT]*sizeof(struct scsi_device),
 354                         GFP_KERNEL);
 355        for (elem = 0; elem < ch->counts[CHET_DT]; elem++) {
 356                id  = -1;
 357                lun = 0;
 358                if (elem < CH_DT_MAX  &&  -1 != dt_id[elem]) {
 359                        id  = dt_id[elem];
 360                        lun = dt_lun[elem];
 361                        vprintk("dt 0x%x: [insmod option] ",
 362                                elem+ch->firsts[CHET_DT]);
 363                } else if (0 != ch_read_element_status
 364                           (ch,elem+ch->firsts[CHET_DT],data)) {
 365                        vprintk("dt 0x%x: READ ELEMENT STATUS failed\n",
 366                                elem+ch->firsts[CHET_DT]);
 367                } else {
 368                        vprintk("dt 0x%x: ",elem+ch->firsts[CHET_DT]);
 369                        if (data[6] & 0x80) {
 370                                if (verbose)
 371                                        printk("not this SCSI bus\n");
 372                                ch->dt[elem] = NULL;
 373                        } else if (0 == (data[6] & 0x30)) {
 374                                if (verbose)
 375                                        printk("ID/LUN unknown\n");
 376                                ch->dt[elem] = NULL;
 377                        } else {
 378                                id  = ch->device->id;
 379                                lun = 0;
 380                                if (data[6] & 0x20) id  = data[7];
 381                                if (data[6] & 0x10) lun = data[6] & 7;
 382                        }
Show full sources