From: Jacob Keller <jacob.e.keller@intel.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
Amir Mohammad Jahangirzad <a.jahangirzad@gmail.com>,
<przemyslaw.kitszel@intel.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [Intel-wired-lan] [PATCH] i40e: replace snprintf() with scnprintf()
Date: Tue, 22 Jul 2025 16:27:56 -0700 [thread overview]
Message-ID: <38c52f32-cca9-4458-a285-33bc142d58c1@intel.com> (raw)
In-Reply-To: <e76d2af6-40d6-4169-8ec9-aeeee31b3aaf@intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 1012 bytes --]
On 7/22/2025 1:17 PM, Tony Nguyen wrote:
>
>
> On 7/22/2025 4:50 AM, Amir Mohammad Jahangirzad wrote:
>> In i40e_dbg_command_read(), a 256-byte buffer is allocated and filled
>> using snprintf(), then copied to userspace via copy_to_user().
>>
>> The issue is that snprintf() returns the number of characters that
>> *Would* have been written, not the number that actually fit in the buffer.
>> If the combined length of the netdev name and i40e_dbg_command_buf is
>> long (e.g. 288 + 3 bytes), snprintf() still returns 291 - even though only
>> 256 bytes were written.
>
> Hi Amir,
>
> Thank you for the patch. In practice, this won't overflow [1]. However,
> this code can be improved. If you follow the thread, there's
> conversation of the changes that will be made.
>
> Thanks,
> Tony
>
> [1] https://lore.kernel.org/netdev/20250714181032.GS721198@horms.kernel.org/
>
Yep. I have patches to just remove this read interface entirely. I hope
to post them later today.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
prev parent reply other threads:[~2025-07-22 23:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 11:50 Amir Mohammad Jahangirzad
2025-07-22 15:57 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-07-22 20:17 ` Tony Nguyen
2025-07-22 23:27 ` Jacob Keller [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=38c52f32-cca9-4458-a285-33bc142d58c1@intel.com \
--to=jacob.e.keller@intel.com \
--cc=a.jahangirzad@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
/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®