public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Pranav Tyagi <pranav.tyagi03@gmail.com>
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	target-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] target/core: replace strncpy with strscpy
Date: Thu, 24 Jul 2025 21:51:55 -0400	[thread overview]
Message-ID: <yq1bjp9rqh5.fsf@ca-mkp.ca.oracle.com> (raw)
In-Reply-To: <20250706092522.9298-1-pranav.tyagi03@gmail.com> (Pranav Tyagi's message of "Sun, 6 Jul 2025 14:55:22 +0530")


Pranav,

> strncpy() is deprecated and its use is discouraged. Replace strncpy()
> with safer strscpy() as the p_buf buffer should be NUL-terminated,
> since it holds human readable debug output strings.

If you must do this, please change all the similar occurrences of
strncpy() in that file instead of just one of them.

However, given the fixed size of the buffer and the length of all the
defined static strings, what is the actual problem you are fixing?

-- 
Martin K. Petersen

  parent reply	other threads:[~2025-07-25  1:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-06  9:25 [PATCH] target/core: replace strncpy with strscpy Pranav Tyagi
2025-07-10 13:29 ` Pranav Tyagi
2025-07-25  1:51 ` Martin K. Petersen [this message]
2025-07-25 12:16   ` Pranav Tyagi
2025-07-29  3:09     ` Martin K. Petersen
2025-07-29  9:17       ` Pranav Tyagi

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=yq1bjp9rqh5.fsf@ca-mkp.ca.oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=pranav.tyagi03@gmail.com \
    --cc=skhan@linuxfoundation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox