Re: [PATCH 2.6.19] e1000: Replace kmalloc+memset with kcalloc +remove now unused size variable

From: David Rientjes
Date: Tue Dec 12 2006 - 14:32:38 EST


On Tue, 12 Dec 2006, Yan Burman wrote:

> diff -rubp linux-2.6.19_orig/drivers/net/e1000/e1000_ethtool.c linux-2.6.19/drivers/net/e1000/e1000_ethtool.c
> --- linux-2.6.19_orig/drivers/net/e1000/e1000_ethtool.c 2006-11-30 21:28:21.000000000 +0200
> +++ linux-2.6.19/drivers/net/e1000/e1000_ethtool.c 2006-12-12 20:54:31.000000000 +0200
> @@ -1045,19 +1045,18 @@ e1000_setup_desc_rings(struct e1000_adap
> struct e1000_rx_ring *rxdr = &adapter->test_rx_ring;
> struct pci_dev *pdev = adapter->pdev;
> uint32_t rctl;
> - int size, i, ret_val;
> + int i, ret_val;
>
> /* Setup Tx descriptor ring and Tx buffers */
>
> if (!txdr->count)
> txdr->count = E1000_DEFAULT_TXD;
>
> - size = txdr->count * sizeof(struct e1000_buffer);
> - if (!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) {
> + if (!(txdr->buffer_info = kcalloc(size, sizeof(struct e1000_buffer),
> + GFP_KERNEL))) {

This wasn't compile-tested; you already removed the 'size' auto variable.

Needs to be
kcalloc(txdr->count, sizeof(struct e1000_buffer), GFP_KERNEL)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/