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]
Message-ID: <aYo2JBW76jH44lAU@google.com>
Date: Mon, 9 Feb 2026 11:31:48 -0800
From: Igor Pylypiv <ipylypiv@...gle.com>
To: Bart Van Assche <bvanassche@....org>
Cc: "James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
	"Martin K. Petersen" <martin.petersen@...cle.com>,
	linux-scsi@...r.kernel.org, linux-ide@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH v2] scsi: core: Add 'serial' sysfs attribute for
 SCSI/SATA

On Mon, Feb 09, 2026 at 09:31:39AM -0800, Bart Van Assche wrote:
> On 2/5/26 10:00 AM, Igor Pylypiv wrote:
> > +	return sysfs_emit(buf, "%s\n", buf);
> 
> Since many snprintf() variants do not allow to specify the output buffer as
> input argument, the above seems risky to me. Has it been considered to
> replace the above statement with the following?
> 
> 	return sysfs_emit_at(buf, strlen(buf), "\n");

Thank you for pointing this out, Bart! I've now realized that you
pointed out this in V1 as well but I misunderstood your comment.

sysfs_emit_at() returns number of characters written starting at &buf[at]
so it would return 1 for the added newline. We can add the number of
characters written by scsi_vpd_lun_serial() to return the correct number
of characters:

	return ret + sysfs_emit_at(buf, ret, "\n");

This looks a bit too complicated/ugly to me. Instead, I will put a newline
manually and return the correct number of characters. PAGE_SIZE is passed
to scsi_vpd_lun_serial() so we don't sysfs_emit_at() to check it again.

	buf[ret] = '\n';
	return ret + 1;

Let me know if this sounds good to you.

Thank you!
Igor

> 
> Thanks,
> 
> Bart.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ