All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Andrew Lunn <andrew@lunn.ch>, netdev <netdev@vger.kernel.org>,
	Nicolas Pitre <nico@fluxnic.net>,
	"Lee Jones" <lee.jones@linaro.org>
Subject: Re: [PATCH net-next v2 1/7] drivers: net: smc91x: Fix set but unused W=1 warning
Date: Fri, 6 Nov 2020 09:42:13 -0800	[thread overview]
Message-ID: <20201106094213.62250632@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <749857e283f04d3b8f84f603fa065cd6@AcuMS.aculab.com>

On Fri, 6 Nov 2020 08:48:47 +0000 David Laight wrote:
> > > +#define SMC_GET_PKT_HDR_STATUS(lp, status)				\
> > > +	do {								\
> > > +		if (SMC_32BIT(lp)) {					\
> > > +			unsigned int __val = SMC_inl(ioaddr, DATA_REG(lp)); \
> > > +			(status) = __val & 0xffff;			\
> > > +		} else {						\
> > > +			(status) = SMC_inw(ioaddr, DATA_REG(lp));	\
> > > +		}							\
> > > +	} while (0)  
> > 
> > This is the original/full macro:
> > 
> > #define SMC_GET_PKT_HDR(lp, status, length)				\
> > 	do {								\
> > 		if (SMC_32BIT(lp)) {				\
> > 			unsigned int __val = SMC_inl(ioaddr, DATA_REG(lp)); \
> > 			(status) = __val & 0xffff;			\
> > 			(length) = __val >> 16;				\
> > 		} else {						\
> > 			(status) = SMC_inw(ioaddr, DATA_REG(lp));	\
> > 			(length) = SMC_inw(ioaddr, DATA_REG(lp));	\
> > 		}							\
> > 	} while (0)
> > 
> > Note that it reads the same address twice in the else branch.
> > 
> > I'm 90% sure we can't remove the read here either so best treat it
> > like the ones in patch 3, right?  
> 
> One of the two SMC_inw() needs to use 'ioaddr + 2'.
> Probably the one for (length).
> 
> The code may also be buggy on BE systems.

More proof that this code is fragile.

Changing IO accesses is not acceptable in a "warning cleanup" patch,
unless it can be tested on real HW.

We can follow up on the issues you see separately, please.

  reply	other threads:[~2020-11-06 17:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 15:48 [PATCH net-next v2 0/7] smsc W=1 warning fixes Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 1/7] drivers: net: smc91x: Fix set but unused W=1 warning Andrew Lunn
2020-11-05 22:37   ` Jakub Kicinski
2020-11-06  8:48     ` David Laight
2020-11-06 17:42       ` Jakub Kicinski [this message]
2020-11-04 15:48 ` [PATCH net-next v2 2/7] drivers: net: smc91x: Fix missing kerneldoc reported by W=1 Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 3/7] drivers: net: smc911x: Work around set but unused status Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 4/7] drivers: net: smc911x: Fix set but unused status because of DBG macro Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 5/7] drivers: net: smc911x: Fix passing wrong number of parameters to DBG() macro Andrew Lunn
2020-11-04 15:48 ` [PATCH net-next v2 6/7] drivers: net: smc911x: Fix cast from pointer to integer of different size Andrew Lunn
2020-11-05 22:47   ` Jakub Kicinski
2020-11-06  8:44     ` David Laight
2020-11-06 15:05       ` Nicolas Pitre
2020-11-06 15:29         ` David Laight
2020-11-06 15:47           ` Nicolas Pitre
2020-11-04 15:48 ` [PATCH net-next v2 7/7] drivers: net: smsc: Add COMPILE_TEST support Andrew Lunn

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=20201106094213.62250632@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=David.Laight@ACULAB.COM \
    --cc=andrew@lunn.ch \
    --cc=lee.jones@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=nico@fluxnic.net \
    /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.