mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sage Weil <sage@inktank.com>
To: Paul Bolle <pebolle@tiscali.nl>
Cc: Yehuda Sadeh <yehuda@inktank.com>, Alex Elder <elder@inktank.com>,
	ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rbd: silence GCC warnings
Date: Tue, 18 Jun 2013 08:10:47 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1306180810380.23632@cobra.newdream.net> (raw)
In-Reply-To: <1371463963.26299.9.camel@x61.thuisdomein>

This was already fixed up in teh testing branch; thanks!

On Mon, 17 Jun 2013, Paul Bolle wrote:

> Building rbd.o triggers two GCC warnings:
>     drivers/block/rbd.c: In function ?rbd_img_request_fill?:
>     drivers/block/rbd.c:1272:22: warning: ?bio_list? may be used uninitialized in this function [-Wmaybe-uninitialized]
>     drivers/block/rbd.c:2170:14: note: ?bio_list? was declared here
>     drivers/block/rbd.c:2231:10: warning: ?pages? may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> Apparently GCC has trouble determining that "bio_list" is unused if "type"
> is "OBJ_REQUEST_PAGES" and, conversely, that "pages" will be unused if
> "type" is "OBJ_REQUEST_BIO". Add harmless initializations to NULL to
> help GCC.
> 
> Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
> ---
> 0) Compile tested only.
> 
> 1) These warnings were introduced in v3.10-rc1, apparently through
> commit f1a4739f33 ("rbd: support page array image requests"). 
> 
> 2) Note that
>     rbd_assert(type == OBJ_REQUEST_PAGES);
> 
> seems redundant. I see no way that this assertion could ever be false. 
> 
>  drivers/block/rbd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 3063452..b8a58178 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2185,9 +2185,11 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request,
>  	if (type == OBJ_REQUEST_BIO) {
>  		bio_list = data_desc;
>  		rbd_assert(img_offset == bio_list->bi_sector << SECTOR_SHIFT);
> +		pages = NULL;
>  	} else {
>  		rbd_assert(type == OBJ_REQUEST_PAGES);
>  		pages = data_desc;
> +		bio_list = NULL;
>  	}
>  
>  	while (resid) {
> -- 
> 1.8.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

      reply	other threads:[~2013-06-18 15:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 10:12 Paul Bolle
2013-06-18 15:10 ` Sage Weil [this message]

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=alpine.DEB.2.00.1306180810380.23632@cobra.newdream.net \
    --to=sage@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=elder@inktank.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=yehuda@inktank.com \
    /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®