Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: netdev <netdev@vger.kernel.org>, Aurelien Guillaume <aurelien@iwi.me>
Subject: Re: [PATCH ethtool] Fix iteration count in sff8472_calibration()
Date: Fri, 8 Nov 2013 16:54:58 +0000	[thread overview]
Message-ID: <1383929698.3802.24.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <1379813802.21174.36.camel@deadeye.wl.decadent.org.uk>

On Sun, 2013-09-22 at 02:36 +0100, Ben Hutchings wrote:
> We want to iterate over all elements of the various arrays of readings
> (which all have the same dimensions - and maybe ought to be a single
> array).  Unfortunately the iteration count is sizeof(sd->bias_cur) and
> bias_cur has 2-byte elements, so we iterate over twice as many
> elements as are really there.
> 
> Compiler-detected, and compile-tested only.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---

Applied.  Thanks, me.

Ben.

>  sfpdiag.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sfpdiag.c b/sfpdiag.c
> index f67e491..04fd880 100644
> --- a/sfpdiag.c
> +++ b/sfpdiag.c
> @@ -224,7 +224,7 @@ static void sff8472_calibration(const __u8 *id, struct sff8472_diags *sd)
>  	__u16 rx_reading;
>  
>  	/* Calibration should occur for all values (threshold and current) */
> -	for (i = 0; i < sizeof(sd->bias_cur); ++i) {
> +	for (i = 0; i < ARRAY_SIZE(sd->bias_cur); ++i) {
>  		/*
>  		 * Apply calibration formula 1 (Temp., Voltage, Bias, Tx Power)
>  		 */
> 

-- 
Ben Hutchings, Staff Engineer, Solarflare
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:[~2013-11-08 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-22  1:36 [PATCH ethtool] Fix iteration count in sff8472_calibration() Ben Hutchings
2013-11-08 16:54 ` 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=1383929698.3802.24.camel@bwh-desktop.uk.level5networks.com \
    --to=bhutchings@solarflare.com \
    --cc=aurelien@iwi.me \
    --cc=ben@decadent.org.uk \
    --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