[PATCH]Please review the patch
Matt Mackall
mpm at selenic.com
Thu Jun 21 10:44:44 CDT 2007
On Thu, Jun 21, 2007 at 04:28:42PM +0530, pradeep singh wrote:
> 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.
You probably want to instead check it before entering the loop:
if (!bi)
/* error handling */
Where /* error handling */ probably consists of a printk and a goto to
the cleanup code.
> 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));
--
Mathematics is the supreme nostalgia of our time.
More information about the Kernel-mentors
mailing list