1
0
Fork 0
alistair23-linux/drivers/net/fs_enet
Julia Lawall 4ecc8c066f drivers/net/fs_enet: remove null pointer dereference
The following code appears in the function fs_init_instance in the file drivers/net/fs_enet/fs_enet-main.c.

	if (fep->ops == NULL) {
		printk(KERN_ERR DRV_MODULE_NAME
		       ": %s No matching ops found (%d).\n",
		       ndev->name, fpi->fs_no);
		err = -EINVAL;
		goto err;
	}

This code implies that at the point of err, fep->ops can be NULL, so an
extra test is needed before dereferencing this value.

This problem was found using the following semantic match
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression E, E1;
identifier f;
statement S1,S2,S3;
@@

* if (E == NULL)
{
  ... when != if (E == NULL) S1 else S2
      when != E = E1
* E->f
  ... when any
  return ...;
}
else S3
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-05-22 06:26:28 -04:00
..
Kconfig [FS_ENET]: Fix module build. 2007-11-14 15:51:01 -08:00
Makefile [FS_ENET]: Fix module build. 2007-11-14 15:51:01 -08:00
fec.h [PATCH] FS_ENET: use PAL for mii management 2006-08-19 17:44:31 -04:00
fs_enet-main.c drivers/net/fs_enet: remove null pointer dereference 2008-05-22 06:26:28 -04:00
fs_enet.h [POWERPC] CPM: Rename commproc to cpm1 and cpm2_common.c to cpm2.c 2008-01-28 08:31:05 -06:00
mac-fcc.c [POWERPC] Move CPM command handling into the cpm drivers 2007-12-13 22:47:16 -06:00
mac-fec.c [POWERPC] CPM: Rename commproc to cpm1 and cpm2_common.c to cpm2.c 2008-01-28 08:31:05 -06:00
mac-scc.c [POWERPC] CPM: Rename commproc to cpm1 and cpm2_common.c to cpm2.c 2008-01-28 08:31:05 -06:00
mii-bitbang.c phy: Change mii_bus id field to a string 2008-04-16 20:09:35 -04:00
mii-fec.c fs_enet: Fix a memory leak in fs_enet_mdio_probe 2008-05-06 12:22:37 -04:00