Re: [PATCH v2] alpha/PCI: Fix I/O port accessor argument order in pci_legacy_write()
Magnus Lindholm <[email protected]> Wed, 8 Jul 2026 12:56:19 +0200
| Newsgroups | gmane.linux.kernel,gmane.linux.ports.alpha,gmane.linux.kernel.pci |
|---|---|
| Message-ID | <CA+=Fv5T8GUH-d0PG6fjn6ARRcenpcDmsg8uy3dJbQ2gKZ85KhQ@mail.gmail.com> |
On Mon, Jul 6, 2026 at 7:54=E2=80=AFPM Krzysztof Wilczy=C5=84ski <[email protected]> wrote: > > pci_legacy_write() in arch/alpha/kernel/pci-sysfs.c passes its arguments > to outb(), outw() and outl() in the wrong order: > > outb(port, val); > > The Alpha I/O accessors in arch/alpha/include/asm/io.h take the value > first and the port second: > > extern void outb(u8 b, unsigned long port); > > So the port number is written as data to the I/O address taken from the > user-supplied value, and the intended write to the requested port never > happens. > > The arguments have been reversed since the file was added, and the > function returns the access size regardless, so the caller sees success > while the requested port is left untouched. > > Fixes: 10a0ef39fbd1 ("PCI/alpha: pci sysfs resources") > Tested-by: Magnus Lindholm <[email protected]> > Reviewed-by: Magnus Lindholm <[email protected]> > Cc: [email protected] > Signed-off-by: Krzysztof Wilczy=C5=84ski <[email protected]> > --- > Changes in v2: > https://lore.kernel.org/linux-pci/20260612232400.585195-1-kwilczynski@ke= rnel.org/ > > - Collected Reviewed-by and Tested-by tags from Magnus Lindholm. > > arch/alpha/kernel/pci-sysfs.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.= c > index 94dbc470cd6c..7050f0f7fe3d 100644 > --- a/arch/alpha/kernel/pci-sysfs.c > +++ b/arch/alpha/kernel/pci-sysfs.c > @@ -224,17 +224,17 @@ int pci_legacy_write(struct pci_bus *bus, loff_t po= rt, u32 val, size_t size) > > switch(size) { > case 1: > - outb(port, val); > + outb(val, port); > return 1; > case 2: > if (port & 1) > return -EINVAL; > - outw(port, val); > + outw(val, port); > return 2; > case 4: > if (port & 3) > return -EINVAL; > - outl(port, val); > + outl(val, port); > return 4; > } > return -EINVAL; > -- > 2.55.0 > Thanks for doing this, this is just me acking the v2 version of this patch, please go ahead and take this through your tree. Acked-by: Magnus Lindholm <[email protected]>