On Fri, 23 May 2008 10:31:25 -0700
David Brownell <[EMAIL PROTECTED]> wrote:
> On Wednesday 21 May 2008, Andrew Morton wrote:
> > On Wed, 21 May 2008 17:04:56 -0700 David Brownell <[EMAIL PROTECTED]> wrote:
> >
> > > From: Grant Likely <[EMAIL PROTECTED]>
> > > ...
> > > - proxy->modalias = chip->modalias;
> > > + strncpy(proxy->modalias, chip->modalias, KOBJ_NAME_LEN);
> > > ...
> >
> > a) strncpy() doesn't null-terminate the dest if it overran. strlcpy() does.
> >
> > b) Given the uncertainly over the state of existing code, perhaps we
> > should have an explicit check for overflows here, with a WARN_ON()?
> >
> > c) I think it's better to use sizeof() in the strlcpy() rather than
> > duplicating the array size - it's a little more robust in the face
> > of future changes and it is more obviously-correct (don't need to go
> > elsewhere to check the size of the destination).
>
> Good points. I usually try to use sizeof() myself, for exactly
> that reason. Updated version (below) uses strlcpy, sizeof, WARN_ON.
For 2.6.26?
>
> > d) KOBJ_NAME_LEN no longer exists in linux-next. I'm not sure where
> > it went - Greg and Kay have been up to their usual tricks.
>
> Yeech. Replacing symbols with inline constants isn't good when
> the constant is what ensures various fields are the same size.
>
> BTW -- four comments on one line is pretty good even for you. ;)
I was quite proud of it ;)
> Signed-off-by: Grant Likely <[EMAIL PROTECTED]>
> [ cope with linux-next changes: KOBJ_NAME_LEN obliterated, etc ]
> Signed-off-by: David Brownell <[EMAIL PROTECTED]>
I have a specific format for this which I never told anyone else about:
[EMAIL PROTECTED]: text goes here]
Immediately before the signoffs.
If you do
git-log | grep '^[ ]*\[akpm@' | wc -l
you'll see how many commits I have deprived myself of ;)
If we stick to that form then perhaps one day those folks who troll the
changelogs to generate who-did-what statistics can incorporate these
things.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general