[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1316249007.1610.13.camel@Joe-Laptop>
Date: Sat, 17 Sep 2011 01:43:26 -0700
From: Joe Perches <joe@...ches.com>
To: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
Cc: davem@...emloft.net, Jesse Brandeburg <jesse.brandeburg@...el.com>,
netdev@...r.kernel.org, gospo@...hat.com
Subject: Re: [net-next 01/13] ixgb: eliminate checkstack warnings
On Sat, 2011-09-17 at 01:04 -0700, Jeff Kirsher wrote:
> From: Jesse Brandeburg <jesse.brandeburg@...el.com>
> Really trivial fix, use kzalloc/kree instead of stack space.
Some more trivialities...
> diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c\
[]
> @@ -1120,8 +1120,12 @@ ixgb_set_multi(struct net_device *netdev)
> rctl |= IXGB_RCTL_MPE;
> IXGB_WRITE_REG(hw, RCTL, rctl);
> } else {
> - u8 mta[IXGB_MAX_NUM_MULTICAST_ADDRESSES *
> - IXGB_ETH_LENGTH_OF_ADDRESS];
> + u8 *mta = kzalloc(IXGB_MAX_NUM_MULTICAST_ADDRESSES *
> + IXGB_ETH_LENGTH_OF_ADDRESS, GFP_KERNEL);
This doesn't need to be kzalloc as every byte is overwritten.
It should be kmalloc.
Maybe delete the #define IXGB_ETH_LENGTH_OF_ADDRESS and
sed 's/\bIXGB_ETH_LENGTH_OF_ADDRESS\b/ETH_ALEN/g' ?
Perhaps this loop could be clearer without the multiply:
i = 0;
netdev_for_each_mc_addr(ha, netdev)
memcpy(&mta[i++ * IXGB_ETH_LENGTH_OF_ADDRESS],
ha->addr, IXGB_ETH_LENGTH_OF_ADDRESS);
Perhaps:
u8 *addr = mta;
netdev_for_each_mc_addr(ha, netdev) {
memcpy(addr, ha->addr, ETH_ALEN);
addr += ETH_ALEN;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists