On Thu, 2019-07-25 at 11:50 -0700, Kees Cook wrote: > On Thu, Jul 25, 2019 at 04:52:19PM +0530, NitinGote wrote: > > From: Nitin Gote <nitin.r.gote@xxxxxxxxx> > > > > Added check in checkpatch.pl to deprecate strcpy(), strlcpy() and > > strncpy() in favor of stracpy(). > > stracpy() is preferred when the destination is a char array (rather than > a string pointer), so that likely needs to be clarified. [] > > 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" => "stracpy", > > + "strlcpy" => "stracpy", > > + "strncpy" => "stracpy - for non-NUL-terminated uses, strncpy dest should be __nonstring", > > +); Maybe: our %deprecated_string_apis = ( "strcpy" => "stracpy or strscpy", "strlcpy" => "stracpy or strscpy", "strncpy" => "stracpy or strscpy - for non-NUL-terminated uses, strncpy dest should be __nonstring", );