From: Sabrina Dubroca <sd@queasysnail.net>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: davem@davemloft.net, bhutchings@solarflare.com, netdev@vger.kernel.org
Subject: Re: [PATCH v2 5/5] alx: add stats to ethtool
Date: Mon, 6 Jan 2014 11:57:42 +0100 [thread overview]
Message-ID: <20140106105742.GA30142@kria> (raw)
In-Reply-To: <1388998990.5891.0.camel@jlt4.sipsolutions.net>
[2014-01-06, 10:03:10] Johannes Berg wrote:
> On Sat, 2014-01-04 at 17:47 +0100, Sabrina Dubroca wrote:
>
> > + __alx_update_hw_stats(hw);
> > + BUILD_BUG_ON(sizeof(hw->stats) - offsetof(struct alx_hw_stats, rx_ok) <
> > + ALX_NUM_STATS * sizeof(u64));
>
> I think you should make that != instead of <, otherwise you won't catch
> all possible differences.
With a !=, BUILD_BUG_ON is triggered if a new field is added at the
end of the structure. But adding a field doesn't break the code,
though I'm not sure allowing this is useful. The offsetof (and the
source in memcpy) also allows to add new fields at the beginning.
And the way alx_update_hw_stats is written already includes a kind of
check that all fields are present.
--
Sabrina
next prev parent reply other threads:[~2014-01-06 10:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-04 16:47 [PATCH v2 0/5] alx: add statistics Sabrina Dubroca
2014-01-04 16:47 ` [PATCH v2 1/5] alx: add a hardware stats structure Sabrina Dubroca
2014-01-04 16:47 ` [PATCH v2 2/5] alx: add constants for the stats fields Sabrina Dubroca
2014-01-04 16:47 ` [PATCH v2 3/5] alx: add stats update function Sabrina Dubroca
2014-01-04 22:16 ` Stephen Hemminger
2014-01-04 23:16 ` Sabrina Dubroca
2014-01-04 16:47 ` [PATCH v2 4/5] alx: add alx_get_stats64 operation Sabrina Dubroca
2014-01-04 16:47 ` [PATCH v2 5/5] alx: add stats to ethtool Sabrina Dubroca
2014-01-06 9:03 ` Johannes Berg
2014-01-06 10:57 ` Sabrina Dubroca [this message]
2014-01-06 14:11 ` Johannes Berg
2014-01-06 14:56 ` Sabrina Dubroca
2014-01-06 15:16 ` Johannes Berg
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=20140106105742.GA30142@kria \
--to=sd@queasysnail.net \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=netdev@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 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).