[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150929.211011.677113057504126372.davem@davemloft.net>
Date: Tue, 29 Sep 2015 21:10:11 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: wangweidong1@...wei.com
Cc: sony.chacko@...gic.com, Dept-HSGLinuxNICDev@...gic.com,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
rui.xiang@...wei.com, manish.chopra@...gic.com
Subject: Re: [PATCH net-next v2 RESEND] BNX2: fix a Null Pointer for
stats_blk
From: Weidong Wang <wangweidong1@...wei.com>
Date: Tue, 29 Sep 2015 11:18:18 +0800
> @@ -839,11 +828,12 @@ bnx2_free_mem(struct bnx2 *bp)
> }
>
> static int
> -bnx2_alloc_mem(struct bnx2 *bp)
> +bnx2_alloc_stats_blk(struct net_device *dev)
> {
> - int i, status_blk_size, err;
> + int i, status_blk_size;
> struct bnx2_napi *bnapi;
> void *status_blk;
> + struct bnx2 *bp = netdev_priv(dev);
>
> /* Combine status and statistics blocks into one allocation. */
> status_blk_size = L1_CACHE_ALIGN(sizeof(struct status_block));
This function is not just allocating the stats block, it's allocating
a whole bunch of other things too.
Only allocate the stats block at probe time, not the NAPI et al. stuff
as well. That can safely stay in the open/close paths.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists