linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Christophe Lombard <clombard@linux.vnet.ibm.com>,
	Vaibhav Jain <vaibhav@linux.vnet.ibm.com>,
	Frederic Barrat <fbarrat@linux.vnet.ibm.com>,
	stable@vger.kernel.org,
	Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] ocxl: Fix endiannes bug in read_afu_name()
Date: Thu, 20 Dec 2018 15:53:04 +0100	[thread overview]
Message-ID: <20181220155304.7ac65e6f@bahia.lan> (raw)
In-Reply-To: <6119504a-1400-3ccf-0a90-310025081708@au1.ibm.com>

On Wed, 12 Dec 2018 13:26:10 +1100
Andrew Donnellan <andrew.donnellan@au1.ibm.com> wrote:

> On 12/12/18 4:58 am, Greg Kurz wrote:
> > The AFU Descriptor Template in the PCI config space has a Name Space
> > field which is a 24 Byte ASCII character string of descriptive name
> > space for the AFU. The OCXL driver read the string four characters at
> > a time with pci_read_config_dword().
> > 
> > This optimization is valid on a little-endian system since this is PCI,
> > but a big-endian system ends up with each subset of four characters in
> > reverse order.
> > 
> > This could be fixed by switching to read characters one by one. Another
> > option is to swap the bytes if we're big-endian.
> > 
> > Go for the latter with le32_to_cpu().
> > 
> > Cc: stable@vger.kernel.org      # v4.16
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>  
> 
> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> 

Friendly ping before Xmas break :)

> > ---
> > v2: - silence sparse with (__force __le32) cast
> >      - new changelog
> > ---
> >   drivers/misc/ocxl/config.c |    2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c
> > index 57a6bb1fd3c9..8f2c5d8bd2ee 100644
> > --- a/drivers/misc/ocxl/config.c
> > +++ b/drivers/misc/ocxl/config.c
> > @@ -318,7 +318,7 @@ static int read_afu_name(struct pci_dev *dev, struct ocxl_fn_config *fn,
> >   		if (rc)
> >   			return rc;
> >   		ptr = (u32 *) &afu->name[i];
> > -		*ptr = val;
> > +		*ptr = le32_to_cpu((__force __le32) val);
> >   	}
> >   	afu->name[OCXL_AFU_NAME_SZ - 1] = '\0'; /* play safe */
> >   	return 0;
> >   
> 


  reply	other threads:[~2018-12-20 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 17:58 [PATCH v2] ocxl: Fix endiannes bug in read_afu_name() Greg Kurz
2018-12-12  2:26 ` Andrew Donnellan
2018-12-20 14:53   ` Greg Kurz [this message]
2018-12-23 13:28 ` [v2] " 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=20181220155304.7ac65e6f@bahia.lan \
    --to=groug@kaod.org \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=clombard@linux.vnet.ibm.com \
    --cc=fbarrat@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=stable@vger.kernel.org \
    --cc=vaibhav@linux.vnet.ibm.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).