[PATCH]Please review the patch
pradeep singh
pradeep.rautela at gmail.com
Thu Jun 21 05:58:42 CDT 2007
Hi,
Please review the patch.
Am i doing something wrong here?
Is the patch format correct?
Chelsio's in kernel 10G driver does not checks the return value from
t1_get_board_info() in cxgb2.c.
t1_get_board_info may return a NULL and we still go on to dereference
it in the for loop without checking for the NULL.
This patch fixes this by checking for NULL in the test condition for, for loop.
Signed-off-by: Pradeep Singh <pradeep.rautela at gmail.com>
---
drivers/net/chelsio/cxgb2.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 231ce43..edcfeba 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -1023,7 +1023,7 @@ static int __devinit init_one(struct pci_dev *pdev,
mmio_len = pci_resource_len(pdev, 0);
bi = t1_get_board_info(ent->driver_data);
- for (i = 0; i < bi->port_number; ++i) {
+ for (i = 0; bi && i < bi->port_number; ++i) {
struct net_device *netdev;
netdev = alloc_etherdev(adapter ? 0 : sizeof(*adapter));
--
1.4.4.2
Thanks
--
Pradeep
More information about the Kernel-mentors
mailing list