All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: Daniel Axtens <dja@axtens.net>,
	Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	linuxppc-dev@ozlabs.org
Cc: imunsie@au1.ibm.com
Subject: Re: [PATCH] cxl: use correct operator when writing pcie config space values
Date: Fri, 06 Nov 2015 10:17:02 +1100	[thread overview]
Message-ID: <1446765422.3325.7.camel@neuling.org> (raw)
In-Reply-To: <87oaf8hwt2.fsf@gamma.ozlabs.ibm.com>

On Fri, 2015-11-06 at 10:05 +1100, Daniel Axtens wrote:
> Andrew Donnellan <andrew.donnellan@au1.ibm.com> writes:
>=20
> > When writing a value to config space, cxl_pcie_write_config() calls
> > cxl_pcie_config_info() to obtain a mask and shift value, shifts the
> > new
> > value accordingly, then uses the mask to combine the shifted value
> > with the
> > existing value at the address as part of a read-modify-write
> > pattern.
> >=20
> > Currently, we use a logical OR operator rather than a bitwise OR
> > operator,
> > which means any use of this function results in an incorrect value
> > being
> > written. Replace the logical OR operator with a bitwise OR operator
> > so the
> > value is written correctly.
> >=20
> > Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: stable@vger.kernel.org
>=20
> Given that there are no current users of this function, does this
> need
> to go to stable? Does it actually fix a real (as opposed to
> theoretical)
> bug?

Agreed.  Not really needed in stable.

Mikey

>=20
> Regards,
> Daniel
>=20
> > Fixes: 6f7f0b3df6d4 ("cxl: Add AFU virtual PHB and kernel API")
> > Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> > ---
> >  drivers/misc/cxl/vphb.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >=20
> > diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
> > index 94b5208..9be09bb 100644
> > --- a/drivers/misc/cxl/vphb.c
> > +++ b/drivers/misc/cxl/vphb.c
> > @@ -203,7 +203,7 @@ static int cxl_pcie_write_config(struct pci_bus
> > *bus, unsigned int devfn,
> >  	mask <<=3D shift;
> >  	val <<=3D shift;
> > =20
> > -	v =3D (in_le32(ioaddr) & ~mask) || (val & mask);
> > +	v =3D (in_le32(ioaddr) & ~mask) | (val & mask);
> > =20
> >  	out_le32(ioaddr, v);
> >  	return PCIBIOS_SUCCESSFUL;

  reply	other threads:[~2015-11-05 23:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04  2:24 [PATCH] cxl: use correct operator when writing pcie config space values Andrew Donnellan
2015-11-04  4:07 ` Ian Munsie
2015-11-05 23:05 ` Daniel Axtens
2015-11-05 23:17   ` Michael Neuling [this message]
2015-11-05 23:17   ` Andrew Donnellan
2015-11-05 23:43   ` Michael Ellerman
2015-11-09  6:45     ` Andrew Donnellan
2015-11-12  2:26       ` Daniel Axtens
2015-11-26 12:15 ` Michael Ellerman

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=1446765422.3325.7.camel@neuling.org \
    --to=mikey@neuling.org \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=dja@axtens.net \
    --cc=imunsie@au1.ibm.com \
    --cc=linuxppc-dev@ozlabs.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.