From: John Garry <john.g.garry@oracle.com>
To: Thorsten Blum <thorsten.blum@linux.dev>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] scsi: scsi_ioctl: use strnlen in scsi_ioctl_get_pci
Date: Mon, 18 May 2026 08:29:31 +0100 [thread overview]
Message-ID: <d6ef25af-0b1e-4ad2-b62e-78dd01eaa29c@oracle.com> (raw)
In-Reply-To: <20260517171546.2304-2-thorsten.blum@linux.dev>
On 17/05/2026 18:15, Thorsten Blum wrote:
> Use strnlen() to limit string scanning to 20 characters.
>
> Reformat the code and use tabs instead of spaces while at it.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: John Garry <john.g.garry@oracle.com>
> ---
> drivers/scsi/scsi_ioctl.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
> index 0ddc95bafc71..d98c2f19b1e9 100644
> --- a/drivers/scsi/scsi_ioctl.c
> +++ b/drivers/scsi/scsi_ioctl.c
> @@ -176,10 +176,11 @@ static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg)
>
> name = dev_name(dev);
>
> - /* compatibility with old ioctl which only returned
> - * 20 characters */
> - return copy_to_user(arg, name, min(strlen(name), (size_t)20))
> - ? -EFAULT: 0;
> + /* compatibility with old ioctl which only returned 20 characters */
> + if (copy_to_user(arg, name, strnlen(name, 20)))
> + return -EFAULT;
> +
> + return 0;
> }
>
> static int sg_get_version(int __user *p)
>
next prev parent reply other threads:[~2026-05-18 7:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 17:15 Thorsten Blum
2026-05-18 7:29 ` John Garry [this message]
2026-05-23 1:13 ` Martin K. Petersen
2026-06-02 2:10 ` Martin K. Petersen
2026-06-02 9:19 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d6ef25af-0b1e-4ad2-b62e-78dd01eaa29c@oracle.com \
--to=john.g.garry@oracle.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=thorsten.blum@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®