scsi: lpfc: Fix gcc -Wstringop-overread warning

This commit is contained in:
orangepi-xunlong 2023-01-06 18:23:45 +08:00 committed by baiywt
parent aefe970785
commit 3f7db5fc02
1 changed files with 2 additions and 5 deletions

View File

@ -516,11 +516,8 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,
"6314 Catching potential buffer "
"overflow > PAGE_SIZE = %lu bytes\n",
PAGE_SIZE);
strlcpy(buf + PAGE_SIZE - 1 -
strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1),
LPFC_NVME_INFO_MORE_STR,
strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1)
+ 1);
strscpy(buf + PAGE_SIZE - 1 - sizeof(LPFC_NVME_INFO_MORE_STR),
LPFC_NVME_INFO_MORE_STR, sizeof(LPFC_NVME_INFO_MORE_STR) + 1);
}
return len;