public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: andersen@codepoet.org
Cc: Paul P Komkoff Jr <i@stingr.net>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] Some useless cleanup
Date: Sun, 12 May 2002 22:09:54 +1000	[thread overview]
Message-ID: <E176sAl-0000ct-00@wagner.rustcorp.com.au> (raw)
In-Reply-To: Your message of "Thu, 09 May 2002 16:23:58 CST." <20020509222358.GB8651@codepoet.org>

In message <20020509222358.GB8651@codepoet.org> you write:
> On Thu May 09, 2002 at 10:36:50PM +1000, Rusty Russell wrote:
> > Um, why not simply:
> > 
> > static inline void set_name(struct task_struct *tsk, const char *name)
> > {
> > 	/* comm is always nul-terminated already */
> > 	strncpy(tsk->comm, name, sizeof(tsk->comm)-1);
> > }
> > 
> > Your implementation using snprintf is (wasteful and) dangerous,
> > Rusty.
> 
> And both implementations suffer from the fact that if tsk->comm
> were to change from a fixed length array to a char*, allowing
> arbitrarily sized names, you would end up copying very little
> indeed.  :)

Um, yes, if someone were to make a random change to the kernel without
looking at what it would effect, the kernel would likely break.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

  parent reply	other threads:[~2002-05-13  1:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-09 10:28 [RFC] Some useless cleanup Paul P Komkoff Jr
2002-05-09 12:36 ` Rusty Russell
2002-05-09 22:23   ` Erik Andersen
2002-05-10  8:20     ` Bernd Petrovitsch
2002-05-10 11:42     ` Oliver Xymoron
2002-05-12 12:09     ` Rusty Russell [this message]
2002-05-10  9:44   ` Paul P Komkoff Jr
2002-05-09 15:09 ` Denis Vlasenko
2002-05-09 11:33   ` Paul P Komkoff Jr

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=E176sAl-0000ct-00@wagner.rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=andersen@codepoet.org \
    --cc=i@stingr.net \
    --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