All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: tomasz.unger@yahoo.pl
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4] NFC: pn544: i2c: Replace strcpy() with strscpy()
Date: Tue, 3 Mar 2026 20:59:42 +0000	[thread overview]
Message-ID: <20260303205942.GG71509@kernel.org> (raw)
In-Reply-To: <20260301121254.174354-1-tomasz.unger@yahoo.pl>

On Sun, Mar 01, 2026 at 01:12:54PM +0100, tomasz.unger@yahoo.pl wrote:
> From: Tomasz Unger <tomasz.unger@yahoo.pl>
> 
> Replace strcpy() with strscpy() which limits the copy to the size of
> the destination buffer. Since phy->firmware_name is an array, the
> two-argument variant of strscpy() is used - the compiler deduces
> the buffer size automatically.
> 
> This is a defensive cleanup. As pointed out by Jakub Kicinski
> <kuba@kernel.org>, firmware_name is already bounded to
> NFC_FIRMWARE_NAME_MAXSIZE via nla_strscpy() in net/nfc/netlink.c
> before reaching this driver, so no actual buffer overflow is possible.
> 
> Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
> ---
> Changes since v3:
> - Reworded commit message: removed "bug fix" and "buffer overflow"
>   language as pointed out by Jakub Kicinski <kuba@kernel.org>;
>   firmware_name is already bounded via nla_strscpy() in netlink.c
> - Changed submission target from net to net-next (cleanup, not a fix)
> 
> Testing:
> - checkpatch.pl: 0 errors, 0 warnings
> - make M=drivers/nfc/pn544/: compiled successfully, 0 errors, 0 warnings

Reviewed-by: Simon Horman <horms@kernel.org>


  reply	other threads:[~2026-03-03 20:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260301121254.174354-1-tomasz.unger.ref@yahoo.pl>
2026-03-01 12:12 ` [PATCH net-next v4] NFC: pn544: i2c: Replace strcpy() with strscpy() tomasz.unger
2026-03-03 20:59   ` Simon Horman [this message]
2026-03-04  1:30   ` patchwork-bot+netdevbpf

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=20260303205942.GG71509@kernel.org \
    --to=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tomasz.unger@yahoo.pl \
    /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.