mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	linux-scsi@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] strstrip incorrectly marked __must_check
Date: Tue, 03 Nov 2009 13:10:48 -0600	[thread overview]
Message-ID: <1257275448.2454.1.camel@mulgrave.site> (raw)
In-Reply-To: <20091103105921.160d5599.akpm@linux-foundation.org>

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@suse.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



  parent reply	other threads:[~2009-11-03 19:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 18:38 James Bottomley
2009-11-03 18:59 ` Andrew Morton
2009-11-03 19:04   ` Matthew Wilcox
2009-11-03 19:06     ` KOSAKI Motohiro
2009-11-03 19:10     ` Alan Cox
2009-11-03 19:11     ` James Bottomley
2009-11-03 19:10   ` James Bottomley [this message]
2009-11-03 19:12   ` Alan Cox
2009-11-03 19:58     ` KOSAKI Motohiro
2009-11-23 13:04       ` Michael Holzheu
2009-11-24  8:55         ` KOSAKI Motohiro
2009-11-24  9:09           ` Michael Holzheu

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=1257275448.2454.1.camel@mulgrave.site \
    --to=james.bottomley@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@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

all inboxes | Powered by JetHome®