lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 27 Mar 2024 08:40:23 +0100
From: Hannes Reinecke <hare@...e.de>
To: Arnd Bergmann <arnd@...nel.org>, llvm@...ts.linux.dev,
 Hannes Reinecke <hare@...nel.org>, "James E.J. Bottomley"
 <jejb@...ux.ibm.com>, "Martin K. Petersen" <martin.petersen@...cle.com>
Cc: Arnd Bergmann <arnd@...db.de>, Nathan Chancellor <nathan@...nel.org>,
 Nick Desaulniers <ndesaulniers@...gle.com>, Bill Wendling
 <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
 linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 7/9] scsi: mylex: fix sysfs buffer lengths

On 3/26/24 23:38, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> The myrb and myrs drivers use an odd way of implementing their sysfs files,
> calling snprintf() with a fixed length of 32 bytes to print into a page
> sized buffer. One of the strings is actually longer than 32 bytes, which
> clang can warn about:
> 
> drivers/scsi/myrb.c:1906:10: error: 'snprintf' will always be truncated; specified size is 32, but format string expands to at least 34 [-Werror,-Wformat-truncation]
> drivers/scsi/myrs.c:1089:10: error: 'snprintf' will always be truncated; specified size is 32, but format string expands to at least 34 [-Werror,-Wformat-truncation]
> 
> These could all be plain sprintf() without a length as the buffer is
> always long enough. On the other hand, sysfs files should not be overly
> long either, so just double the length to make sure the longest strings
> don't get truncated here.
> 
> Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
> Fixes: 081ff398c56c ("scsi: myrb: Add Mylex RAID controller (block interface)")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>   drivers/scsi/myrb.c | 20 ++++++++++----------
>   drivers/scsi/myrs.c | 24 ++++++++++++------------
>   2 files changed, 22 insertions(+), 22 deletions(-)
> 
Yeah, counting is hard ...

Reviewed-by: Hannes Reinecke <hare@...e.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@...e.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ