Re: [PATCH] pci_raw_ops should use unsigned args

From: Matthew Wilcox
Date: Thu Feb 03 2005 - 14:24:52 EST


On Thu, Feb 03, 2005 at 12:08:05PM -0700, Bjorn Helgaas wrote:
> Convert pci_raw_ops to use unsigned segment (aka domain),
> bus, and devfn. With the previous code, various ia64 config
> accesses fail due to segment sign-extension problems.
>
> ia64:
> - With a signed seg >= 0x8, unwanted sign-extension occurs when
> "seg << 28" is cast to u64 in PCI_SAL_EXT_ADDRESS()
> - PCI_SAL_EXT_ADDRESS(): cast to u64 *before* shifting; otherwise
> "seg << 28" is evaluated as unsigned int (32 bits) and gets
> truncated when seg > 0xf
> - pci_sal_read(): validate "value" ptr as other arches do

I'm not happy about that one -- the PCI access.c guarantees the pointer
is non-NULL. But I'm going to do a sweep to catch all of these, so I'll
just undo it then.

> - pci_sal_{read,write}(): return -EINVAL rather than SAL error status
>
> arch/i386/pci/direct.c | 12 ++++++----
> arch/i386/pci/mmconfig.c | 6 +++--
> arch/i386/pci/numa.c | 6 +++--
> arch/i386/pci/pcbios.c | 6 +++--
> arch/ia64/pci/pci.c | 53 ++++++++++++++++++---------------------------
> arch/x86_64/pci/mmconfig.c | 8 ++++--
> include/linux/pci.h | 6 +++--
> 7 files changed, 51 insertions(+), 46 deletions(-)
>
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>

Acked-by: Matthew Wilcox <matthew@xxxxxx>

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/