> -----Original Message----- > From: Joe Perches [mailto:joe@xxxxxxxxxxx] > Sent: Wednesday, July 24, 2019 11:59 PM > To: Gote, Nitin R <nitin.r.gote@xxxxxxxxx>; Kees Cook > <keescook@xxxxxxxxxxxx> > Cc: corbet@xxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; apw@xxxxxxxxxxxxx; > linux-doc@xxxxxxxxxxxxxxx; kernel-hardening@xxxxxxxxxxxxxxxxxx > Subject: Re: [PATCH v5] Documentation/checkpatch: Prefer > strscpy/strscpy_pad over strcpy/strlcpy/strncpy > > On Wed, 2019-07-24 at 18:17 +0000, Gote, Nitin R wrote: > > Hi, > > Hi again. > > [] > > > > > > 3. Deprecate strncpy() in favor of strscpy() or strscpy_pad(). > > Please remember there does not exist a single actual use of strscpy_pad in > the kernel sources and no apparent real need for it. I don't find one anyway. > Thanks for clarification. I will remove strscpy_pad() from patch. > > Could you please give your opinion on below comment. > > > > > But, if the destination buffer needs extra NUL-padding for remaining > > > size of destination, then safe replacement is strscpy_pad(). Right? > > > If yes, then what is your opinion on below change : > > > > > > "strncpy" => "strscpy, strcpy_pad - for non-NUL-terminated > > > uses, > > > strncpy() dst should be __nonstring", > > > > > If you agree on this, then I will include this change in next patch version. > > Two things: > > The kernel-doc documentation uses dest not dst. Noted. I will correct this. > I think stracpy should be preferred over strscpy. > Agreed. I will use stracpy() instead of strscpy(). Thanks, Nitin