All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: Roel Kluin <12o3l@tiscali.nl>
Cc: "Kok, Auke" <auke-jan.h.kok@intel.com>,
	lkml <linux-kernel@vger.kernel.org>,
	e1000-devel@lists.sourceforge.net
Subject: Re: [PATCH] net/e1000: fix memcpy  in e1000_get_strings
Date: Thu, 29 Nov 2007 08:28:47 -0800	[thread overview]
Message-ID: <474EE8BF.3080107@intel.com> (raw)
In-Reply-To: <474E1BC3.807@tiscali.nl>

Roel Kluin wrote:
> drivers/net/e1000/e1000_ethtool.c:113:
> #define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
> 
> drivers/net/e1000e/ethtool.c:106:
> #define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
> 
> E1000_TEST_LEN*ETH_GSTRING_LEN will expand to 
> sizeof(e1000_gstrings_test) / (ETH_GSTRING_LEN * ETH_GSTRING_LEN)
> 
> Please confirm that the change is as wanted.


Thanks,

I'll take a look at this closely and post these to netdev-2.6.

thanks

Auke


> --
> A lack of parentheses around defines causes unexpected results due to operator
> precedences.
> 
> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> ---
> diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
> index 667f18b..b83ccce 100644
> --- a/drivers/net/e1000/e1000_ethtool.c
> +++ b/drivers/net/e1000/e1000_ethtool.c
> @@ -1923,7 +1923,7 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data)
>  	switch (stringset) {
>  	case ETH_SS_TEST:
>  		memcpy(data, *e1000_gstrings_test,
> -			E1000_TEST_LEN*ETH_GSTRING_LEN);
> +			sizeof(e1000_gstrings_test));
>  		break;
>  	case ETH_SS_STATS:
>  		for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
> diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
> index 6a39784..338c49d 100644
> --- a/drivers/net/e1000e/ethtool.c
> +++ b/drivers/net/e1000e/ethtool.c
> @@ -1739,7 +1739,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset,
>  	switch (stringset) {
>  	case ETH_SS_TEST:
>  		memcpy(data, *e1000_gstrings_test,
> -			E1000_TEST_LEN*ETH_GSTRING_LEN);
> +				sizeof(e1000_gstrings_test));
>  		break;
>  	case ETH_SS_STATS:
>  		for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2007-11-29 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29  1:54 [PATCH] net/e1000: fix memcpy in e1000_get_strings Roel Kluin
2007-11-29 16:28 ` Kok, Auke [this message]
2007-12-05 19:23 ` Kok, Auke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=474EE8BF.3080107@intel.com \
    --to=auke-jan.h.kok@intel.com \
    --cc=12o3l@tiscali.nl \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.