Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32528
Change subject: sb/amd/rs780: Use 32 bit variable to avoid truncation ......................................................................
sb/amd/rs780: Use 32 bit variable to avoid truncation
The {read,write}_index functions expect a 32 bit value, as do the bitwise operations.
Found-by: Coverity Scan #1229584 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Change-Id: Idc2bc46c899d5a4e8b089644dca076a88d97dd7c --- M src/southbridge/amd/rs780/ht.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/32528/1
diff --git a/src/southbridge/amd/rs780/ht.c b/src/southbridge/amd/rs780/ht.c index 94df233..a07839e 100644 --- a/src/southbridge/amd/rs780/ht.c +++ b/src/southbridge/amd/rs780/ht.c @@ -24,7 +24,7 @@ void avoid_lpc_dma_deadlock(struct device *nb_dev, struct device *sb_dev) { struct device *cpu_f0; - u8 reg; + u32 reg;
cpu_f0 = pcidev_on_root(0x18, 0); set_nbcfg_enable_bits(cpu_f0, 0x68, 3 << 21, 1 << 21);
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32528 )
Change subject: sb/amd/rs780: Use 32 bit variable to avoid truncation ......................................................................
Patch Set 1: Code-Review+2
(1 comment)
https://review.coreboot.org/#/c/32528/1/src/southbridge/amd/rs780/ht.c File src/southbridge/amd/rs780/ht.c:
https://review.coreboot.org/#/c/32528/1/src/southbridge/amd/rs780/ht.c@27 PS1, Line 27: reg maybe reg32 ?
Hello Kyösti Mälkki, HAOUAS Elyes, Paul Menzel, build bot (Jenkins), Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32528
to look at the new patch set (#2).
Change subject: sb/amd/rs780: Use 32 bit variable to avoid truncation ......................................................................
sb/amd/rs780: Use 32 bit variable to avoid truncation
The {read,write}_index functions expect a 32 bit value, as do the bitwise operations.
Found-by: Coverity Scan #1229584 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Change-Id: Idc2bc46c899d5a4e8b089644dca076a88d97dd7c --- M src/southbridge/amd/rs780/ht.c 1 file changed, 10 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/32528/2
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32528 )
Change subject: sb/amd/rs780: Use 32 bit variable to avoid truncation ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/#/c/32528/1/src/southbridge/amd/rs780/ht.c File src/southbridge/amd/rs780/ht.c:
https://review.coreboot.org/#/c/32528/1/src/southbridge/amd/rs780/ht.c@27 PS1, Line 27: reg
maybe reg32 ?
Done
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32528 )
Change subject: sb/amd/rs780: Use 32 bit variable to avoid truncation ......................................................................
Patch Set 2: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32528 )
Change subject: sb/amd/rs780: Use 32 bit variable to avoid truncation ......................................................................
sb/amd/rs780: Use 32 bit variable to avoid truncation
The {read,write}_index functions expect a 32 bit value, as do the bitwise operations.
Found-by: Coverity Scan #1229584 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Change-Id: Idc2bc46c899d5a4e8b089644dca076a88d97dd7c Reviewed-on: https://review.coreboot.org/c/coreboot/+/32528 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: HAOUAS Elyes ehaouas@noos.fr --- M src/southbridge/amd/rs780/ht.c 1 file changed, 10 insertions(+), 10 deletions(-)
Approvals: build bot (Jenkins): Verified HAOUAS Elyes: Looks good to me, approved
diff --git a/src/southbridge/amd/rs780/ht.c b/src/southbridge/amd/rs780/ht.c index 94df233..8943fc1 100644 --- a/src/southbridge/amd/rs780/ht.c +++ b/src/southbridge/amd/rs780/ht.c @@ -24,24 +24,24 @@ void avoid_lpc_dma_deadlock(struct device *nb_dev, struct device *sb_dev) { struct device *cpu_f0; - u8 reg; + u32 reg32;
cpu_f0 = pcidev_on_root(0x18, 0); set_nbcfg_enable_bits(cpu_f0, 0x68, 3 << 21, 1 << 21);
- reg = nbpcie_p_read_index(sb_dev, 0x10); - reg |= 0x100; /* bit9=1 */ - nbpcie_p_write_index(sb_dev, 0x10, reg); + reg32 = nbpcie_p_read_index(sb_dev, 0x10); + reg32 |= 0x100; /* bit9=1 */ + nbpcie_p_write_index(sb_dev, 0x10, reg32);
- reg = nbpcie_p_read_index(nb_dev, 0x10); - reg |= 0x100; /* bit9=1 */ - nbpcie_p_write_index(nb_dev, 0x10, reg); + reg32 = nbpcie_p_read_index(nb_dev, 0x10); + reg32 |= 0x100; /* bit9=1 */ + nbpcie_p_write_index(nb_dev, 0x10, reg32);
/* Enable NP protocol over PCIE for memory-mapped writes targeting LPC * Set this bit to avoid a deadlock condition. */ - reg = htiu_read_index(nb_dev, 0x6); - reg |= 0x1000000; /* bit26 */ - htiu_write_index(nb_dev, 0x6, reg); + reg32 = htiu_read_index(nb_dev, 0x6); + reg32 |= 0x1000000; /* bit26 */ + htiu_write_index(nb_dev, 0x6, reg32); }
static void pcie_init(struct device *dev)