From: Dan Carpenter on 1 Jul 2010 13:50 On Thu, Jul 01, 2010 at 05:16:43PM +0400, Kulikov Vasiliy wrote: > - Sg_fd *sfp; > + Sg_fd *sfp = filp->private_data; ^^^^^^^^^^^^^^^^^^ Dereferenced here. > unsigned long req_sz, len, sa; > Sg_scatter_hold *rsv_schp; > int k, length; > > - if ((!filp) || (!vma) || (!(sfp = (Sg_fd *) filp->private_data))) > + if ((!filp) || (!vma) || !(sfp)) ^^^^^ Checked here. I obviously just spotted that during the review but another way would be to use smatch to catch these. (http://smatch.sf.net) $ /path/to/smatch_scripts/kchecker drivers/scsi/sg.c CHK include/linux/version.h CHK include/generated/utsrelease.h CALL scripts/checksyscalls.sh CHECK drivers/scsi/sg.c drivers/scsi/sg.c +1236 sg_mmap(7) warn: variable dereferenced before check 'filp' CC [M] drivers/scsi/sg.o $ You could also get rid of the extra parenthesis. + if (!filp || !vma || !sfp) > return -ENXIO; > req_sz = vma->vm_end - vma->vm_start; > SCSI_LOG_TIMEOUT(3, printk("sg_mmap starting, vm_start=%p, len=%d\n", Btw. These are _way_ better than when you sent them the first time. Thanks for doing resending them. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Kulikov Vasiliy on 1 Jul 2010 14:30 On Thu, Jul 01, 2010 at 19:38 +0200, Dan Carpenter wrote: > On Thu, Jul 01, 2010 at 05:16:43PM +0400, Kulikov Vasiliy wrote: > > - Sg_fd *sfp; > > + Sg_fd *sfp = filp->private_data; > ^^^^^^^^^^^^^^^^^^ > Dereferenced here. > > > unsigned long req_sz, len, sa; > > Sg_scatter_hold *rsv_schp; > > int k, length; > > > > - if ((!filp) || (!vma) || (!(sfp = (Sg_fd *) filp->private_data))) > > + if ((!filp) || (!vma) || !(sfp)) > ^^^^^ > > Checked here. Oops, I've loosed it... The problem is that this driver is not even compileable. Patch v2 coming soon) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Kulikov Vasiliy on 2 Jul 2010 03:10 On Thu, Jul 01, 2010 at 22:27 +0400, Kulikov Vasiliy wrote: > The problem is that this driver is not even compileable. Forget about this. staging/wlags49_h2/wl_pci.c is not compileable, not scsi/sg.c :) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: mm: iommu: The Virtual Contiguous Memory Manager Next: [00/23] 2.6.27.48 stable review |