[PATCH] ocxl: Fix endiannes bug in read_afu_name()

Greg Kurz groug at kaod.org
Tue Dec 11 19:33:01 AEDT 2018


On Tue, 11 Dec 2018 11:24:08 +1100
Andrew Donnellan <andrew.donnellan at au1.ibm.com> wrote:

> On 11/12/18 11:05 am, Andrew Donnellan wrote:
> > On 11/12/18 2:10 am, Greg Kurz wrote:  
> >> The double word returned by read_afu_info(OCXL_DVSEC_TEMPL_NAME) contains
> >> four characters of the AFU name, read from the PCI config space, hence
> >> with a little-endian ordering. When composing the string, a big-endian
> >> system must swap the bytes so that the characters appear in the right
> >> order.
> >>
> >> Do this with le32_to_cpu().
> >>
> >> Signed-off-by: Greg Kurz <groug at kaod.org>  
> > 
> > snowpatch reports the following sparse warning:
> > 
> > +drivers/misc/ocxl/config.c:321:24: warning: cast to restricted __le32
> > 
> > You probably need to change val from a u32 to a __le32.  
> 

You might be right, I'll look into this.

> Also does this need to go to stable?
> 

Oops... this bug has been there since the beginning, so yes
it does. I simply forgot to add the Cc: stable tag... :-\

Cheers,

--
Greg


More information about the Linuxppc-dev mailing list