public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Meyering <jim@meyering.net>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: a few strncpy-related patches
Date: Mon, 20 Aug 2012 22:47:27 +0200	[thread overview]
Message-ID: <87393hl28w.fsf@rho.meyering.net> (raw)
In-Reply-To: <m24nnx8ggt.fsf@firstfloor.org> (Andi Kleen's message of "Mon, 20 Aug 2012 13:18:42 -0700")

Andi Kleen wrote:
> Jim Meyering <jim@meyering.net> writes:
>
>> I've seen a few too many cases of strncpy misuse.
>> Looking through linux sources, I spotted/fixed these:
>>
>> [PATCH] ACPI: remove unwarranted use of strncpy
>> [PATCH] fs/9p: avoid debug OOPS when reading a long symlink
>> [PATCH] kmemleak: avoid buffer overrun: NUL-terminate strncpy-copied
>> [PATCH] bfa: avoid buffer overrun for 12-byte model name
>> [PATCH] cifs: remove misleading strncpy: each name has length < 16
>
> Better to convert tham all to strlcpy?
>
> The kernel has it.

Anything is better than strncpy.
Is there consensus here that strlcpy is preferred?
Would the integrator(s) even require consensus?

    $ git grep -w strncpy|wc -l
    987
    $ git grep -w strlcpy|wc -l
    1345

In any case, shouldn't fixing bugs and obvious misuse be separate
from any global NSC conversion?

      reply	other threads:[~2012-08-20 20:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-20 16:55 a few strncpy-related patches Jim Meyering
2012-08-20 16:55 ` [PATCH] ACPI: remove unwarranted use of strncpy Jim Meyering
2012-08-20 16:55 ` [PATCH] fs/9p: avoid debug OOPS when reading a long symlink Jim Meyering
2012-08-21  7:20   ` [PATCHv2] " Jim Meyering
2012-08-20 16:55 ` [PATCH] kmemleak: avoid buffer overrun: NUL-terminate strncpy-copied command Jim Meyering
2012-08-24 10:27   ` Catalin Marinas
2012-08-24 11:23     ` Jim Meyering
2012-08-28 20:24       ` Dan Carpenter
2012-08-29  6:28         ` Jim Meyering
2012-08-29 15:56           ` Dan Carpenter
2012-08-20 16:55 ` [PATCH] bfa: avoid buffer overrun for 12-byte model name Jim Meyering
2012-08-20 19:42   ` Krishna Gudipati
2012-08-20 20:38     ` Jim Meyering
2012-10-14  7:53       ` Jim Meyering
2012-10-14  8:20         ` Jim Meyering
2012-12-24  7:43           ` Vijay Mohan Guvva
2012-08-20 16:55 ` [PATCH] cifs: remove misleading strncpy: each name has length < 16 Jim Meyering
     [not found]   ` <CAE2SPAbBmRov9qK2HiBQBQXaZpfJ8pmZJ-PL18FEyoZhzDza4A@mail.gmail.com>
2012-08-20 18:40     ` Jim Meyering
2012-08-20 18:41   ` Jim Meyering
2012-08-20 20:18 ` a few strncpy-related patches Andi Kleen
2012-08-20 20:47   ` Jim Meyering [this message]

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=87393hl28w.fsf@rho.meyering.net \
    --to=jim@meyering.net \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@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