Messages in this thread |  | | Subject | Re: [PATCH] ocfs2: dereference before NULL check in ocfs2_direct_IO_get_blocks() | | From | Arjan van de Ven <> | | Date | Sun, 04 Jun 2006 11:15:30 +0200 |
| |
On Sat, 2006-06-03 at 14:16 -0700, Joel Becker wrote: > On Sat, Jun 03, 2006 at 11:15:58PM +0400, Alexey Dobriyan wrote: > > On Sat, Jun 03, 2006 at 11:34:39AM -0400, Florin Malita wrote: > > > 'bh_result' & 'inode' are explicitly checked against NULL so they > > > shouldn't be dereferenced prior to that. > > > > > > Coverity ID: 1273, 1274. > > > > AFAICS, the patch is BS, as usual with this type of patches. > > > > Can "inode" and "bh_result" be NULL here? I bet they can't. > > This is a common result of this sort of scan. The scan merely > provides good information, not a perfect patch. There are two > possibilities: > > 1) The scan is right, and the dereference is dangerous. The > patch is correct. > 2) The dereference is not dangerous ("can't happen"), and the > later check for NULL is spurious. A correct patch would > merely remove the check. > > This is clearly a case of (2), but I bet that (1) is seen just > as often.
and in case of (2); newer gcc is often smart enough to do that automatically :)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |