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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux