[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1257275448.2454.1.camel@mulgrave.site>
Date: Tue, 03 Nov 2009 13:10:48 -0600
From: James Bottomley <James.Bottomley@...e.de>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
linux-scsi@...r.kernel.org,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] strstrip incorrectly marked __must_check
On Tue, 2009-11-03 at 10:59 -0800, Andrew Morton wrote:
> On Tue, 03 Nov 2009 12:38:08 -0600
> James Bottomley <James.Bottomley@...e.de> wrote:
>
> > strstrip strips whitespace from the beginning and end of a string. I
> > agree you have to take the returned pointer if you want to strip from
> > the beginning. However, if you wish to keep the whitespace at the
> > beginning and only wish strstrip to remove it from the end, then it's
> > entirely legitimate to discard the returned pointer.
> >
> > This is what we have in drivers/scsi/ipr.c and the patch to make
> > strstrip __must_check is now causing SCSI spurious warnings in that
> > code.
> >
>
> Would prefer to keep the warning and to patch ipr.c, please. We found
> I think three call sites which were incorrectly ignoring the strstrip()
> return value and it's reasonable to fear that others will make the same
> mistake in the future.
What's the problem with the mistake ... additional leading whitespace?
> And maybe ipr.c _should_ be patched. Right now it's assuming that the
> string coming back from the device has no leading whitespace. Why trim
> any possible trailing whitespace but not trim any possible leading
> whitespace?
I think it doesn't care. It wants to append an error code to the
string, and to make it more visible it wants to strip trailing
whitespace before doing so.
> Or..
>
> /*
> * Comment goes here
> */
> static inline void strsrip_tail(char *str)
> {
> char *x __used;
> x = strstrip(str);
> }
Yes, I could go for that ... I just don't see such a problem with the
currently overloaded uses of strstrip.
James
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists