[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/8] kern: fix printing of kmem_cache names
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 1/8] kern: fix printing of kmem_cache names |
Date: |
Sun, 2 Feb 2014 00:11:59 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Sat 01 Feb 2014 16:34:20 +0100, a écrit :
> Quoting Samuel Thibault (2014-02-01 15:20:55)
> > Justus Winter, le Sat 01 Feb 2014 15:09:21 +0100, a écrit :
> > > The name field is not necessarily zero-terminated. Use a precision
> > > argument to limit the number of characters written when printing the
> > > name.
> >
> > Mmm, I'd probably rather see the name field always be zero-terminated,
> > since that's just one place, vs the various places which would want to
> > print it.
>
> I thought about doing that. But that would waste one character just
> for the termination.
That's little compared to security :)
> GNU Machs printf implementation supports strings with the precision
> given as argument:
>
> printf ("%.*s", sizeof foo->name, foo->name);
>
> I think thats clean, concise and easy to use.
But people would tend to forget doing it. We can't really fight that.
Samuel
- Re: [PATCH 5/8] include: add a fixed-size string type for debugging purposes, (continued)
[PATCH 8/8] doc: document task_set_name, Justus Winter, 2014/02/01
Re: [PATCH 1/8] kern: fix printing of kmem_cache names, Samuel Thibault, 2014/02/01