diff options
| author | Jiri Kosina <jikos@kernel.org> | 2026-08-21 15:39:15 +0200 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-08-21 15:59:01 +0200 |
| commit | d0ad81b2b5feea2e8b08a529c0e0d1fbaca98333 (patch) | |
| tree | 7c32d2da2f2d3bfcf837fba19f757e4e746265f4 /scripts/objdiff | |
| parent | 445fcd33c501be4be41806715f5b7ec80200f9f7 (diff) | |
| download | linux-next-d0ad81b2b5feea2e8b08a529c0e0d1fbaca98333.tar.gz linux-next-d0ad81b2b5feea2e8b08a529c0e0d1fbaca98333.zip | |
HID: hyperv: make pointer arithmetics understandable for FORTIFY_SOURCE
Commit 83df7b5fa6735b5084ecd2 ("HID: hyperv: add KUnit coverage for device info
bounds") introduced this piece of code
report = ((u8 *)&info->hid_descriptor) + info->hid_descriptor.bLength;
memset(report, 0x42, 4);
to populate the report, making use of the fact that the report
&info->hid_descriptor points to a struct hid_descriptor (which is a fixed-size
struct).
GCC's FORTIFY_SOURCE infer the object size from that specific struct field
rather than the outer dynamically allocated info buffer. As a result, writing
past sizeof(struct hid_descriptor) triggers the __write_overflow_field warning.
Calculate the pointer offset using info directly, so the compiler evaluates the
memory bounds against the allocated flexible layout of struct
synthhid_device_info instead of the nested struct.
Fixes: 83df7b5fa6735b5084ecd2 ("HID: hyperv: add KUnit coverage for device info bounds")
Reported-by: Jürgen Groß <jgross@suse.com>
Tested-by: Jürgen Groß <jgross@suse.com>
Acked-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'scripts/objdiff')
0 files changed, 0 insertions, 0 deletions
