summaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2024-03-26 15:53:37 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-13 12:50:14 +0200
commit81e38e4e2c756c95267c758bf683b35ce0ca77b1 (patch)
tree4e7f5111773f834c011639e9c4c34ce1dfa7a141 /drivers/firmware
parenta6f9bd4aee2c96d597b765af5f3a61a2b8d8e98c (diff)
downloadlinux-stable-81e38e4e2c756c95267c758bf683b35ce0ca77b1.tar.gz
linux-stable-81e38e4e2c756c95267c758bf683b35ce0ca77b1.tar.bz2
linux-stable-81e38e4e2c756c95267c758bf683b35ce0ca77b1.zip
ata: sata_sx4: fix pdc20621_get_from_dimm() on 64-bit
[ Upstream commit 52f80bb181a9a1530ade30bc18991900bbb9697f ] gcc warns about a memcpy() with overlapping pointers because of an incorrect size calculation: In file included from include/linux/string.h:369, from drivers/ata/sata_sx4.c:66: In function 'memcpy_fromio', inlined from 'pdc20621_get_from_dimm.constprop' at drivers/ata/sata_sx4.c:962:2: include/linux/fortify-string.h:97:33: error: '__builtin_memcpy' accessing 4294934464 bytes at offsets 0 and [16, 16400] overlaps 6442385281 bytes at offset -2147450817 [-Werror=restrict] 97 | #define __underlying_memcpy __builtin_memcpy | ^ include/linux/fortify-string.h:620:9: note: in expansion of macro '__underlying_memcpy' 620 | __underlying_##op(p, q, __fortify_size); \ | ^~~~~~~~~~~~~ include/linux/fortify-string.h:665:26: note: in expansion of macro '__fortify_memcpy_chk' 665 | #define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \ | ^~~~~~~~~~~~~~~~~~~~ include/asm-generic/io.h:1184:9: note: in expansion of macro 'memcpy' 1184 | memcpy(buffer, __io_virt(addr), size); | ^~~~~~ The problem here is the overflow of an unsigned 32-bit number to a negative that gets converted into a signed 'long', keeping a large positive number. Replace the complex calculation with a more readable min() variant that avoids the warning. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/firmware')
0 files changed, 0 insertions, 0 deletions