From: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [patch 2.6.26-rc3] spi: make spi_board_info.modalias a char array
Date: Fri, 23 May 2008 11:33:51 -0700 [thread overview]
Message-ID: <20080523113351.8c16bd02.akpm@linux-foundation.org> (raw)
In-Reply-To: <200805231031.25919.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
On Fri, 23 May 2008 10:31:25 -0700
David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> wrote:
> On Wednesday 21 May 2008, Andrew Morton wrote:
> > On Wed, 21 May 2008 17:04:56 -0700 David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> wrote:
> >
> > > From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> > > ...
> > > - 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 <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> [ cope with linux-next changes: KOBJ_NAME_LEN obliterated, etc ]
> Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
I have a specific format for this which I never told anyone else about:
[email@address: 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/
next prev parent reply other threads:[~2008-05-23 18:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-22 0:04 [patch 2.6.26-rc3] spi: make spi_board_info.modalias a char array David Brownell
[not found] ` <200805211704.56761.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-22 3:46 ` Andrew Morton
[not found] ` <20080521204633.8234c7d7.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-05-23 17:31 ` David Brownell
[not found] ` <200805231031.25919.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-23 17:38 ` Grant Likely
2008-05-23 18:33 ` Andrew Morton [this message]
[not found] ` <20080523113351.8c16bd02.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-05-23 18:45 ` David Brownell
[not found] ` <200805231145.09786.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-23 18:45 ` Grant Likely
2008-07-17 22:33 ` Grant Likely
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=20080523113351.8c16bd02.akpm@linux-foundation.org \
--to=akpm-de/tnxtf+jlsfhdxvbkv3wd2fqjk+8+b@public.gmane.org \
--cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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;
as well as URLs for NNTP newsgroup(s).