diff options
author | Arnd Bergmann <[email protected]> | 2023-02-14 14:28:08 +0100 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2023-02-21 22:00:50 -0500 |
commit | ee4e7dfe4ffc9ca50c6875757bd119abfe22b5c5 (patch) | |
tree | 6022277724e6e965f55fe9a167e0b1066e545a22 /net/lapb/lapb_in.c | |
parent | 3a2d1efaf344c7351945532020774c3fcb134a0a (diff) |
scsi: ipr: Work around fortify-string warning
The ipr_log_vpd_compact() function triggers a fortified memcpy() warning
about a potential string overflow with all versions of clang:
In file included from drivers/scsi/ipr.c:43:
In file included from include/linux/string.h:254:
include/linux/fortify-string.h:520:4: error: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
__write_overflow_field(p_size_field, size);
^
include/linux/fortify-string.h:520:4: error: call to '__write_overflow_field' declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
2 errors generated.
I don't see anything actually wrong with the function, but this is the only
instance I can reproduce of the fortification going wrong in the kernel at
the moment, so the easiest solution may be to rewrite the function into
something that does not trigger the warning.
Instead of having a combined buffer for vendor/device/serial strings, use
three separate local variables and just truncate the whitespace
individually.
Link: https://lore.kernel.org/r/[email protected]
Cc: Kees Cook <[email protected]>
Fixes: 8cf093e275d0 ("[SCSI] ipr: Improved dual adapter errors")
Signed-off-by: Arnd Bergmann <[email protected]>
Reviewed-by: Damien Le Moal <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Acked-by: Brian King <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'net/lapb/lapb_in.c')
0 files changed, 0 insertions, 0 deletions