mbox series

[0/2] scsi: myrb: Fix a potential string truncation

Message ID cover.1702411083.git.christophe.jaillet@wanadoo.fr
Headers show
Series scsi: myrb: Fix a potential string truncation | expand

Message

Christophe JAILLET Dec. 12, 2023, 8:09 p.m. UTC
Patch 1/2 fixes a potential string truncation issue in rebuild_show(). It is
intended to be minimal in order to ease potential backport.

Patch 2/2 is a bigger patch that turns some snprintf() usage in _show functions
into preferred sysfs_emit() calls.
This patch overrides the changes made in 1/2.


There is another warning when building with W=1:
    1051 |                 "%u.%02u-%c-%02u",
         |                 ^~~~~~~~~~~~~~~~~
   drivers/scsi/myrb.c:1050:9: note: ‘snprintf’ output between 10 and 14 bytes into a destination of size 12
but I think that it is a false positive because snprintf() in Linux does not
strickly folows the standard C behavior of snprintf(). If I understand correctly
Linux handles %02u when C ignores it.

Christophe JAILLET (2):
  scsi: myrb: Fix a potential string truncation in rebuild_show()
  scsi: myrb: Use sysfs_emit()

 drivers/scsi/myrb.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)