diff options
author | Kees Cook <keescook@chromium.org> | 2022-02-27 11:59:18 -0800 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2022-05-19 12:47:30 +0200 |
commit | aeb84412037b89e06f45e382f044da6f200e12f8 (patch) | |
tree | 36d2cb929b460f9c5badb5b9d739bddbf0c8d9e0 /Documentation/x86 | |
parent | 9b5a7f4a2a8dcda461f9c7a6671150f4a8a902e8 (diff) | |
download | linux-aeb84412037b89e06f45e382f044da6f200e12f8.tar.bz2 |
x86/boot: Wrap literal addresses in absolute_pointer()
GCC 11 (incorrectly[1]) assumes that literal values cast to (void *)
should be treated like a NULL pointer with an offset, and raises
diagnostics when doing bounds checking under -Warray-bounds. GCC 12
got "smarter" about finding these:
In function 'rdfs8',
inlined from 'vga_recalc_vertical' at /srv/code/arch/x86/boot/video-mode.c:124:29,
inlined from 'set_mode' at /srv/code/arch/x86/boot/video-mode.c:163:3:
/srv/code/arch/x86/boot/boot.h:114:9: warning: array subscript 0 is outside array bounds of 'u8[0]' {aka 'unsigned char[]'} [-Warray-bounds]
114 | asm volatile("movb %%fs:%1,%0" : "=q" (v) : "m" (*(u8 *)addr));
| ^~~
This has been solved in other places[2] already by using the recently
added absolute_pointer() macro. Do the same here.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
[2] https://lore.kernel.org/all/20210912160149.2227137-1-linux@roeck-us.net/
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220227195918.705219-1-keescook@chromium.org
Diffstat (limited to 'Documentation/x86')
0 files changed, 0 insertions, 0 deletions