Hi,

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.

Signed-off-by: Pradeep Singh <[EMAIL PROTECTED]>
---
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
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to