From: Heiko Carstens <hca@linux.ibm.com>
To: Kevin Paul Reddy Janagari <kevinpaul468@gmail.com>
Cc: gor@linux.ibm.com, agordeev@linux.ibm.com,
borntraeger@linux.ibm.com, svens@linux.ibm.com,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org
Subject: Re: [PATCH] Removing deprecated strncpy()
Date: Thu, 10 Apr 2025 13:54:04 +0200 [thread overview]
Message-ID: <20250410115404.8774F32-hca@linux.ibm.com> (raw)
In-Reply-To: <20250410113230.28116-1-kevinpaul468@gmail.com>
On Thu, Apr 10, 2025 at 05:02:30PM +0530, Kevin Paul Reddy Janagari wrote:
> This patch suggests the replacement of strncpy with strscpy
> as per the Documentation/process/deprecated
> the strncpy() fails to guarntee NULL termination
> since the function adds zero pads, this isn't really convenient
> for short strings as it may cause performce issues
>
> strscpy() is a preffered replacement because
> it overcomes the limitations of strncpy as mentioned above
>
> Signed-off-by: Kevin Paul Reddy Janagari <kevinpaul468@gmail.com>
> ---
> arch/s390/boot/printk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/boot/printk.c b/arch/s390/boot/printk.c
> index 8cf6331bc060..8f3b2244ef1b 100644
> --- a/arch/s390/boot/printk.c
> +++ b/arch/s390/boot/printk.c
> @@ -158,7 +158,7 @@ static noinline char *strsym(char *buf, void *ip)
>
> p = findsym((unsigned long)ip, &off, &len);
> if (p) {
> - strncpy(buf, p, MAX_SYMLEN);
> + strscpy(buf, p, MAX_SYMLEN);
This won't even compile. Please compile test before sending any patches.
next prev parent reply other threads:[~2025-04-10 11:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 11:32 [PATCH] Removing deprecated strncpy() Kevin Paul Reddy Janagari
2025-04-10 11:54 ` Heiko Carstens [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-04-10 12:32 Kevin Paul Reddy Janagari
2025-04-11 1:10 ` Tung Quang Nguyen
2025-04-11 5:06 Kevin Paul Reddy Janagari
2025-04-11 5:22 ` Tung Quang Nguyen
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=20250410115404.8774F32-hca@linux.ibm.com \
--to=hca@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=kevinpaul468@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=svens@linux.ibm.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 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.