lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 23 Nov 2009 11:39:30 -0800
From:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>
To:	Roel Kluin <roel.kluin@...il.com>
Cc:	Jesse Brandeburg <jesse.brandeburg@...el.com>,
	Bruce Allan <bruce.w.allan@...el.com>,
	PJ Waskiewicz <peter.p.waskiewicz.jr@...el.com>,
	John Ronciak <john.ronciak@...el.com>,
	e1000-devel@...ts.sourceforge.net,
	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] e1000e: Use sizeof struct rather than pointer in 
	e1000_get_eeprom()

On Sun, Nov 22, 2009 at 06:31, Roel Kluin <roel.kluin@...il.com> wrote:
> Don't use the sizeof the pointer to clear the result
>
> Signed-off-by: Roel Kluin <roel.kluin@...il.com>
> ---
>  drivers/net/e1000e/ethtool.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
>> -             memset(eeprom_buff, 0xff, sizeof(eeprom_buff));
>> +             memset(eeprom_buff, 0xff, sizeof(*eeprom_buff));
>
> No it's probably still not correct, eeprom_buff was kmalloc'd with:
>
> eeprom_buff = kmalloc(sizeof(u16) *
>                        (last_word - first_word + 1), GFP_KERNEL);
>
> How about:
>
> diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
> index 1bf4d2a..5b276c0 100644
> --- a/drivers/net/e1000e/ethtool.c
> +++ b/drivers/net/e1000e/ethtool.c
> @@ -508,7 +508,8 @@ static int e1000_get_eeprom(struct net_device *netdev,
>
>        if (ret_val) {
>                /* a read error occurred, throw away the result */
> -               memset(eeprom_buff, 0xff, sizeof(eeprom_buff));
> +               memset(eeprom_buff, 0xff, sizeof(u16) *
> +                               (last_word - first_word + 1));
>        } else {
>                /* Device's eeprom is always little-endian, word addressable */
>                for (i = 0; i < last_word - first_word + 1; i++)
> --

Thanks Roel.  I will add this to my tree for testing and review.

-- 
Cheers,
Jeff
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ