diff options
| author | Arnd Bergmann <[email protected]> | 2021-03-22 17:02:47 +0100 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2021-04-01 22:58:34 -0400 |
| commit | ada48ba70f6b98b7e93eea56770d6e6932734783 (patch) | |
| tree | 74581f5d2fba740d4aa9fd3655efd6ba7e36f267 /tools/perf/scripts/python | |
| parent | ae3645d29d4e5f496206ee571d0c8361bd38e242 (diff) | |
scsi: lpfc: Fix gcc -Wstringop-overread warning
gcc-11 warns about an strnlen with a length larger than the size of the
passed buffer:
drivers/scsi/lpfc/lpfc_attr.c: In function 'lpfc_nvme_info_show':
drivers/scsi/lpfc/lpfc_attr.c:518:25: error: 'strnlen' specified bound 4095 exceeds source size 24 [-Werror=stringop-overread]
518 | strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this case, the code is entirely valid, as the string is properly
terminated, and the size argument is only there out of extra caution in
case it exceeds a page.
This cannot really happen here, so just simplify it to a sizeof().
Link: https://lore.kernel.org/r/[email protected]
Fixes: afff0d2321ea ("scsi: lpfc: Add Buffer overflow check, when nvme_info larger than PAGE_SIZE")
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions