All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: ecashin@coraid.com
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [Suggestion] drivers/block/aoe: using uninitialized variable.
Date: Wed, 27 Mar 2013 15:14:01 +0800	[thread overview]
Message-ID: <51529C39.7050207@asianux.com> (raw)

Hello Ed L. Cashin

  when compiling with EXTRA_CFLAGS=-W

  get the warning:
    drivers/block/aoe/aoecmd.c:931:20: warning: ‘bv’ is used uninitialized in this function [-Wuninitialized]

  bv is really not initialized.
    (and it seems only set "buf->bv_resid = 0" is not enough).

  thanks.

gchen.

 919 static void
 920 bufinit(struct buf *buf, struct request *rq, struct bio *bio)
 921 {
 922         struct bio_vec *bv;
 923 
 924         memset(buf, 0, sizeof(*buf));
 925         buf->rq = rq;
 926         buf->bio = bio;
 927         buf->resid = bio->bi_size;
 928         buf->sector = bio->bi_sector;
 929         bio_pageinc(bio);
 930         buf->bv = bio_iovec(bio);
 931         buf->bv_resid = bv->bv_len;
 932         WARN_ON(buf->bv_resid == 0);
 933 }



             reply	other threads:[~2013-03-27  7:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27  7:14 Chen Gang [this message]
2013-03-27 14:04 ` [Suggestion] drivers/block/aoe: using uninitialized variable Ed Cashin
2013-03-28  1:51   ` Chen Gang F T

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=51529C39.7050207@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=ecashin@coraid.com \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.