netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: Solarflare linux maintainers <linux-net-drivers@solarflare.com>,
	Steve Hodgson <shodgson@solarflare.com>,
	netdev@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] sfc: EFX_ETHTOOL_STAT calculates the offset of the efx##source_name's field in both cases
Date: Wed, 20 Jan 2010 03:12:19 +0000	[thread overview]
Message-ID: <1263957139.6090.3.camel@localhost> (raw)
In-Reply-To: <4B56659E.3040001@gmail.com>

On Wed, 2010-01-20 at 03:08 +0100, Roel Kluin wrote:
> EFX_ETHTOOL_STAT calculated the offset of the efx##source_name's field
> Regardless of whether that field was NULL.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> This looks like a bug, but I am not sure whether I understood this correctly,
> nor was it tested, was this intended?

The condition is really a type check.  The result should be the same
regardless of whether it is true.

Ben.

> diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
> index 6c0bbed..722bac7 100644
> --- a/drivers/net/sfc/ethtool.c
> +++ b/drivers/net/sfc/ethtool.c
> @@ -41,7 +41,7 @@ struct efx_ethtool_stat {
>  	.source = EFX_ETHTOOL_STAT_SOURCE_##source_name,		\
>  	.offset = ((((field_type *) 0) ==				\
>  		      &((struct efx_##source_name *)0)->field) ?	\
> -		    offsetof(struct efx_##source_name, field) :		\
> +		    offsetof(struct efx_##stat_name, field) :		\
>  		    offsetof(struct efx_##source_name, field)),		\
>  	.get_stat = get_stat_function,					\
>  }

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

      reply	other threads:[~2010-01-20  3:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20  2:08 [PATCH] sfc: EFX_ETHTOOL_STAT calculates the offset of the efx##source_name's field in both cases Roel Kluin
2010-01-20  3:12 ` Ben Hutchings [this message]

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=1263957139.6090.3.camel@localhost \
    --to=bhutchings@solarflare.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=roel.kluin@gmail.com \
    --cc=shodgson@solarflare.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).