mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: fix overflow build issue
@ 2024-08-21  6:51 Sherry Yang
  2024-08-21 17:00 ` Justin Tee
  2024-08-23  1:56 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Sherry Yang @ 2024-08-21  6:51 UTC (permalink / raw)
  To: james.smart, dick.kennedy, James.Bottomley, martin.petersen
  Cc: linux-kernel, linux-scsi, sherry.yang

Build failed while enabling "CONFIG_GCOV_KERNEL=y" and
"CONFIG_GCOV_PROFILE_ALL=y" with following error:

BUILDSTDERR: drivers/scsi/lpfc/lpfc_bsg.c: In function 'lpfc_get_cgnbuf_info':
BUILDSTDERR: ./include/linux/fortify-string.h:114:33: error: '__builtin_memcpy' accessing 18446744073709551615 bytes at offsets 0 and 0 overlaps 9223372036854775807 bytes at offset -9223372036854775808 [-Werror=restrict]
BUILDSTDERR:   114 | #define __underlying_memcpy     __builtin_memcpy
BUILDSTDERR:       |                                 ^
BUILDSTDERR: ./include/linux/fortify-string.h:637:9: note: in expansion of macro '__underlying_memcpy'
BUILDSTDERR:   637 |         __underlying_##op(p, q, __fortify_size);                        \
BUILDSTDERR:       |         ^~~~~~~~~~~~~
BUILDSTDERR: ./include/linux/fortify-string.h:682:26: note: in expansion of macro '__fortify_memcpy_chk'
BUILDSTDERR:   682 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
BUILDSTDERR:       |                          ^~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: drivers/scsi/lpfc/lpfc_bsg.c:5468:9: note: in expansion of macro 'memcpy'
BUILDSTDERR:  5468 |         memcpy(cgn_buff, cp, cinfosz);
BUILDSTDERR:       |         ^~~~~~

This happens from the commit 06bb7fc0feee ("kbuild: turn on -Wrestrict
by default"). Address this issue by using size_t type.

Signed-off-by: Sherry Yang <sherry.yang@oracle.com>
---
 drivers/scsi/lpfc/lpfc_bsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 4156419c52c7..4756a3f82531 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -5410,7 +5410,7 @@ lpfc_get_cgnbuf_info(struct bsg_job *job)
 	struct get_cgnbuf_info_req *cgnbuf_req;
 	struct lpfc_cgn_info *cp;
 	uint8_t *cgn_buff;
-	int size, cinfosz;
+	size_t size, cinfosz;
 	int  rc = 0;
 
 	if (job->request_len < sizeof(struct fc_bsg_request) +
-- 
2.45.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: lpfc: fix overflow build issue
  2024-08-21  6:51 [PATCH] scsi: lpfc: fix overflow build issue Sherry Yang
@ 2024-08-21 17:00 ` Justin Tee
  2024-08-23  1:56 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Justin Tee @ 2024-08-21 17:00 UTC (permalink / raw)
  To: Sherry Yang
  Cc: james.smart, dick.kennedy, James.Bottomley, martin.petersen,
	linux-kernel, linux-scsi, Justin Tee

Reviewed-by: Justin Tee <justin.tee@broadcom.com>

Thanks looks fine.

Regards,
Justin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: lpfc: fix overflow build issue
  2024-08-21  6:51 [PATCH] scsi: lpfc: fix overflow build issue Sherry Yang
  2024-08-21 17:00 ` Justin Tee
@ 2024-08-23  1:56 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2024-08-23  1:56 UTC (permalink / raw)
  To: james.smart, dick.kennedy, James.Bottomley, Sherry Yang
  Cc: Martin K . Petersen, linux-kernel, linux-scsi

On Tue, 20 Aug 2024 23:51:31 -0700, Sherry Yang wrote:

> Build failed while enabling "CONFIG_GCOV_KERNEL=y" and
> "CONFIG_GCOV_PROFILE_ALL=y" with following error:
> 
> BUILDSTDERR: drivers/scsi/lpfc/lpfc_bsg.c: In function 'lpfc_get_cgnbuf_info':
> BUILDSTDERR: ./include/linux/fortify-string.h:114:33: error: '__builtin_memcpy' accessing 18446744073709551615 bytes at offsets 0 and 0 overlaps 9223372036854775807 bytes at offset -9223372036854775808 [-Werror=restrict]
> BUILDSTDERR:   114 | #define __underlying_memcpy     __builtin_memcpy
> BUILDSTDERR:       |                                 ^
> BUILDSTDERR: ./include/linux/fortify-string.h:637:9: note: in expansion of macro '__underlying_memcpy'
> BUILDSTDERR:   637 |         __underlying_##op(p, q, __fortify_size);                        \
> BUILDSTDERR:       |         ^~~~~~~~~~~~~
> BUILDSTDERR: ./include/linux/fortify-string.h:682:26: note: in expansion of macro '__fortify_memcpy_chk'
> BUILDSTDERR:   682 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
> BUILDSTDERR:       |                          ^~~~~~~~~~~~~~~~~~~~
> BUILDSTDERR: drivers/scsi/lpfc/lpfc_bsg.c:5468:9: note: in expansion of macro 'memcpy'
> BUILDSTDERR:  5468 |         memcpy(cgn_buff, cp, cinfosz);
> BUILDSTDERR:       |         ^~~~~~
> 
> [...]

Applied to 6.11/scsi-fixes, thanks!

[1/1] scsi: lpfc: fix overflow build issue
      https://git.kernel.org/mkp/scsi/c/3417c9574e36

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-23  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-21  6:51 [PATCH] scsi: lpfc: fix overflow build issue Sherry Yang
2024-08-21 17:00 ` Justin Tee
2024-08-23  1:56 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®