linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Wrong usage of kstrtoul() parameter in cxlflash
@ 2021-08-21 20:05 Heiner Kallweit
  0 siblings, 0 replies; only message in thread
From: Heiner Kallweit @ 2021-08-21 20:05 UTC (permalink / raw)
  To: Manoj N. Kumar, Matthew R. Ochs, Uma Krishnan; +Cc: SCSI development list

The following code is used in drivers/scsi/cxlflash/main.c

		memcpy(tmp_buf, &vpd_data[i], WWPN_LEN);
		rc = kstrtoul(tmp_buf, WWPN_LEN, (ulong *)&wwpn[k]);

This seems to be a misinterpretation of kstrtoul parameters.
The second one is not a buffer length but the base for the conversion.
It may work just by chance because WWPN_LEN is 16, and the VPD string
may be a hex number. But definitely WWPN_LEN shouldn't be used here.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-21 20:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21 20:05 Wrong usage of kstrtoul() parameter in cxlflash Heiner Kallweit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).