From: Reto Schneider <code@reto-schneider.ch>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org,
netdev@vger.kernel.org, Stefan Roese <sr@denx.de>,
Reto Schneider <reto.schneider@husqvarnagroup.com>,
"David S. Miller" <davem@davemloft.net>,
Felix Fietkau <nbd@nbd.name>, Jakub Kicinski <kuba@kernel.org>,
John Crispin <john@phrozen.org>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Sean Wang <sean.wang@mediatek.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] net: ethernet: mtk_eth_soc: Support custom ifname
Date: Sun, 13 Jun 2021 15:53:50 +0200 [thread overview]
Message-ID: <aa7a15cc-761f-00b0-5582-a8045d8f30ed@reto-schneider.ch> (raw)
In-Reply-To: <20210613122043.GP22278@shell.armlinux.org.uk>
Hi Russell,
On 13.06.21 14:20, Russell King (Oracle) wrote:
> Please don't use strncpy() - this is a good example why strncpy() is bad
> news.
>
> * strncpy - Copy a length-limited, C-string
> * @dest: Where to copy the string to
> * @src: Where to copy the string from
> * @count: The maximum number of bytes to copy
> *
> * The result is not %NUL-terminated if the source exceeds
> * @count bytes.
>
> Consequently, if "name" is IFNAMSIZ bytes or longer,
> eth->netdev[id]->name will not be NUL terminated, and subsequent use
> will run off the end of the string. strscpy() is safer to use here.
Thanks a lot for finding this (embarrassing mistake) and pointing me in
the right direction (did dot know about strscpy).
Will send v2 soon.
Kind regards,
Reto
next prev parent reply other threads:[~2021-06-13 13:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-13 11:58 [PATCH v1 1/2] dt-bindings: net: mediatek: Support custom ifname Reto Schneider
2021-06-13 11:58 ` [PATCH v1 2/2] net: ethernet: mtk_eth_soc: " Reto Schneider
2021-06-13 12:20 ` Russell King (Oracle)
2021-06-13 13:53 ` Reto Schneider [this message]
2021-06-14 19:48 ` David Miller
2021-06-13 14:58 ` [PATCH v2 1/2] dt-bindings: net: mediatek: " Reto Schneider
2021-06-13 14:59 ` [PATCH v2 2/2] net: ethernet: mtk_eth_soc: " Reto Schneider
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=aa7a15cc-761f-00b0-5582-a8045d8f30ed@reto-schneider.ch \
--to=code@reto-schneider.ch \
--cc=Mark-MC.Lee@mediatek.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=john@phrozen.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=reto.schneider@husqvarnagroup.com \
--cc=sean.wang@mediatek.com \
--cc=sr@denx.de \
/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;
as well as URLs for NNTP newsgroup(s).