From: Joe Perches <joe@perches.com>
To: NitinGote <nitin.r.gote@intel.com>, corbet@lwn.net
Cc: akpm@linux-foundation.org, apw@canonical.com,
keescook@chromium.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
kernel-hardening@lists.openwall.com
Subject: Re: [PATCH v4] Added warnings in checkpatch.pl script to :
Date: Tue, 09 Jul 2019 09:10:16 -0700 [thread overview]
Message-ID: <040b50f00501ae131256bb13a5362731ebdd6bfe.camel@perches.com> (raw)
In-Reply-To: <20190709154806.26363-1-nitin.r.gote@intel.com>
On Tue, 2019-07-09 at 21:18 +0530, NitinGote wrote:
> From: Nitin Gote <nitin.r.gote@intel.com>
>
> 1. Deprecate strcpy() in favor of strscpy().
> 2. Deprecate strlcpy() in favor of strscpy().
> 3. Deprecate strncpy() in favor of strscpy() or strscpy_pad().
>
> Updated strncpy() section in Documentation/process/deprecated.rst
> to cover strscpy_pad() case.
Please slow down your patch submission rate for
this instance and respond appropriately to the
comments you've been given.
This stuff is not critical bug fixing.
The subject could be something like:
Subject: [PATCH v#] Documentation/checkpatch: Prefer strscpy over strcpy/strlcpy
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -605,6 +605,20 @@ foreach my $entry (keys %deprecated_apis) {
> }
> $deprecated_apis_search = "(?:${deprecated_apis_search})";
>
> +our %deprecated_string_apis = (
> + "strcpy" => "strscpy",
> + "strlcpy" => "strscpy",
> + "strncpy" => "strscpy, strscpy_pad or for non-NUL-terminated strings, strncpy() can still be used, but destinations should be marked with the __nonstring",
'the' is not necessary.
There could likely also be a strscat created for
strcat, strlcat and strncat.
btw:
There were several defects in the kernel for misuses
of strlcpy.
Did you or anyone else have an opinion on stracpy
to avoid duplicating the first argument in a
sizeof()?
strlcpy(foo, bar, sizeof(foo))
to
stracpy(foo, bar)
where foo must be char array compatible ?
https://lore.kernel.org/lkml/d1524130f91d7cfd61bc736623409693d2895f57.camel@perches.com/
next prev parent reply other threads:[~2019-07-09 16:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-09 15:48 [PATCH v4] Added warnings in checkpatch.pl script to : NitinGote
2019-07-09 15:58 ` Jonathan Corbet
2019-07-09 16:10 ` Joe Perches [this message]
2019-07-11 3:46 ` Gote, Nitin R
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=040b50f00501ae131256bb13a5362731ebdd6bfe.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=corbet@lwn.net \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nitin.r.gote@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