aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2018-07-04 18:20:41 -0400
committerDave Airlie <airlied@redhat.com>2018-07-09 23:50:31 -0400
commit572d8fda26fecbb6bbb63e917b5610c7157cde96 (patch)
tree77cf84ee30d53749be147be86cdb544d92519938
parent8fb8876b2d1432b352c96add3adefa28d2754672 (diff)
char: amd64-agp: Use 64-bit arithmetic instead of 32-bit
Cast *tmp* and *nb_base* to u64 in order to give the compiler complete information about the proper arithmetic to use. Notice that such variables are used in contexts that expect expressions of type u64 (64 bits, unsigned) and the following expressions are currently being evaluated using 32-bit arithmetic: tmp << 25 nb_base << 25 Addresses-Coverity-ID: 200586 ("Unintentional integer overflow") Addresses-Coverity-ID: 200587 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/char/agp/amd64-agp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index e50c29c97ca7..c69e39fdd02b 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -156,7 +156,7 @@ static u64 amd64_configure(struct pci_dev *hammer, u64 gatt_table)
156 156
157 /* Address to map to */ 157 /* Address to map to */
158 pci_read_config_dword(hammer, AMD64_GARTAPERTUREBASE, &tmp); 158 pci_read_config_dword(hammer, AMD64_GARTAPERTUREBASE, &tmp);
159 aperturebase = tmp << 25; 159 aperturebase = (u64)tmp << 25;
160 aper_base = (aperturebase & PCI_BASE_ADDRESS_MEM_MASK); 160 aper_base = (aperturebase & PCI_BASE_ADDRESS_MEM_MASK);
161 161
162 enable_gart_translation(hammer, gatt_table); 162 enable_gart_translation(hammer, gatt_table);
@@ -277,7 +277,7 @@ static int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, u16 cap)
277 pci_read_config_dword(nb, AMD64_GARTAPERTURECTL, &nb_order); 277 pci_read_config_dword(nb, AMD64_GARTAPERTURECTL, &nb_order);
278 nb_order = (nb_order >> 1) & 7; 278 nb_order = (nb_order >> 1) & 7;
279 pci_read_config_dword(nb, AMD64_GARTAPERTUREBASE, &nb_base); 279 pci_read_config_dword(nb, AMD64_GARTAPERTUREBASE, &nb_base);
280 nb_aper = nb_base << 25; 280 nb_aper = (u64)nb_base << 25;
281 281
282 /* Northbridge seems to contain crap. Try the AGP bridge. */ 282 /* Northbridge seems to contain crap. Try the AGP bridge. */
283 283