x86: pci_io_cfg: Make constant unsigned to fix out of bounds shift
Fix the error below when running a coreboot image built with `CONFIG_UBSAN=y`. PCI: pci_scan_bus for bus 00 shift out of bounds src/arch/x86/include/arch/pci_io_cfg.h:13:20 ubsan: unrecoverable error. GCC with `-fsanitize=shift` also flags this: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' So, make the constant unsigned. TEST=emulation/qemu-i440fx with `CONFIG_UBSAN=y` stops later with [ERROR] unaligned access src/lib/rmodule.c:152:27 [EMERG] ubsan: unrecoverable error. Change-Id: Ib05d225ab9f22078d765009b4ee6ef0c63231eed Found-by: UBSAN Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/51292 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
8febc91b30
commit
688350f33d
|
@ -13,7 +13,7 @@
|
|||
static __always_inline
|
||||
uint32_t pci_io_encode_addr(pci_devfn_t dev, uint16_t reg)
|
||||
{
|
||||
uint32_t addr = 1 << 31;
|
||||
uint32_t addr = 1U << 31;
|
||||
|
||||
addr |= dev >> 4;
|
||||
addr |= reg & 0xfc;
|
||||
|
|
Loading…
Reference in New Issue