From: Thorsten Blum <thorsten.blum@linux.dev>
To: Kees Cook <kees@kernel.org>
Cc: James Smart <james.smart@broadcom.com>,
Ram Vegesna <ram.vegesna@broadcom.com>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-hardening@vger.kernel.org, linux-scsi@vger.kernel.org,
target-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: elx: sli4: Replace deprecated strncpy() with strscpy()
Date: Mon, 7 Apr 2025 22:53:17 +0200 [thread overview]
Message-ID: <60521C02-BD56-4BAD-AB32-561F7A1AAA6A@linux.dev> (raw)
In-Reply-To: <202504071330.90FC6D8@keescook>
On 7. Apr 2025, at 22:30, Kees Cook wrote:
> On Mon, Apr 07, 2025 at 09:01:53PM +0200, Thorsten Blum wrote:
>> On 7. Apr 2025, at 20:28, Kees Cook wrote:
>>> On Wed, Feb 26, 2025 at 07:55:26PM +0100, Thorsten Blum wrote:
>>>> strncpy() is deprecated for NUL-terminated destination buffers; use
>>>> strscpy() instead.
>>>>
>>>> Compile-tested only.
>>>>
>>>> Link: https://github.com/KSPP/linux/issues/90
>>>> Cc: linux-hardening@vger.kernel.org
>>>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>>>> ---
>>>
>>> Standard question for these kinds of conversions: Why is it safe that
>>> this is not NUL padded? I haven't found where this buffer is being
>>> zeroed out, but it probably is (given the "- 1" on the length), but
>>> without run-time testing, this needs much more careful analysis.
>>
>> I think this was submitted before I started to explain this better.
>>
>> 'wr_obj' is the zeroed out 'buf' returned from sli_config_cmd_init().
>
> I don't see how dma->virt and buf are associated?
Since dma is NULL, sli_config_cmd_init() returns config->payload.embed
early (it doesn't get to return dma->virt) and before we have
memset(buf, 0, SLI4_BMBX_SIZE);
config = buf;
and SLI4_BMBX_SIZE is 256 which matches the size of sli4_cmd_sli_config.
It's not very obvious tbh.
prev parent reply other threads:[~2025-04-07 20:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 18:55 [PATCH] scsi: elx: sli4: Replace deprecated strncpy() with strscpy() Thorsten Blum
2025-04-07 18:28 ` Kees Cook
2025-04-07 19:01 ` Thorsten Blum
2025-04-07 20:30 ` Kees Cook
2025-04-07 20:53 ` Thorsten Blum [this message]
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=60521C02-BD56-4BAD-AB32-561F7A1AAA6A@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=James.Bottomley@hansenpartnership.com \
--cc=james.smart@broadcom.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ram.vegesna@broadcom.com \
--cc=target-devel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.