[PATCH] cxl: use correct operator when writing pcie config space values
Daniel Axtens
dja at axtens.net
Fri Nov 6 10:05:13 AEDT 2015
Andrew Donnellan <andrew.donnellan at au1.ibm.com> writes:
> 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.
>
> 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.
>
> Reported-by: Michael Ellerman <mpe at ellerman.id.au>
> Cc: stable at vger.kernel.org
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?
Regards,
Daniel
> Fixes: 6f7f0b3df6d4 ("cxl: Add AFU virtual PHB and kernel API")
> Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
> ---
> drivers/misc/cxl/vphb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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 <<= shift;
> val <<= shift;
>
> - v = (in_le32(ioaddr) & ~mask) || (val & mask);
> + v = (in_le32(ioaddr) & ~mask) | (val & mask);
>
> out_le32(ioaddr, v);
> return PCIBIOS_SUCCESSFUL;
> --
> Andrew Donnellan Software Engineer, OzLabs
> andrew.donnellan at au1.ibm.com Australia Development Lab, Canberra
> +61 2 6201 8874 (work) IBM Australia Limited
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 859 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20151106/8d3fb055/attachment.sig>
More information about the Linuxppc-dev
mailing list