Linux RAID subsystem development
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Lukasz Dorau <lukasz.dorau@intel.com>
Cc: linux-raid@vger.kernel.org, maciej.patelczyk@intel.com
Subject: Re: [PATCH] Grow.c: fix uninitialized variables compilation-time error
Date: Mon, 19 Nov 2012 11:18:00 +1100	[thread overview]
Message-ID: <20121119111800.08edee0c@notabene.brown> (raw)
In-Reply-To: <20121113122943.4041.51702.stgit@gklab-128-085.igk.intel.com>

[-- Attachment #1: Type: text/plain, Size: 1482 bytes --]

On Tue, 13 Nov 2012 13:29:43 +0100 Lukasz Dorau <lukasz.dorau@intel.com>
wrote:

> It fixes the following uninitialized variables compilation-time error:
> WARN  - Grow.c: In function ‘reshape_array’:
> WARN  - Grow.c:2413:21: error: ‘min_space_after’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> WARN  - Grow.c:2376:39: note: ‘min_space_after’ was declared here
> WARN  - Grow.c:2414:22: error: ‘min_space_before’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> WARN  - Grow.c:2376:21: note: ‘min_space_before’ was declared here
> WARN  - cc1: all warnings being treated as errors
> WARN  - make: *** [Grow.o] Error 1
> It occurs during compilation of mdadm on Fedora 17.
> 
> Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
> ---
>  Grow.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/Grow.c b/Grow.c
> index 4de8029..a526a65 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -2373,7 +2373,7 @@ release:
>  static void get_space_after(int fd, struct supertype *st, struct mdinfo *info)
>  {
>  	struct mdinfo *sra, *sd;
> -	unsigned long long min_space_before, min_space_after;
> +	unsigned long long min_space_before = 0, min_space_after = 0;
>  	int first = 1;
>  
>  	sra = sysfs_read(fd, 0, GET_DEVS);

Applied, thanks - though I added a comment to clarify that the initialisation
is only to silence a compiler warning.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2012-11-19  0:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13 12:29 [PATCH] Grow.c: fix uninitialized variables compilation-time error Lukasz Dorau
2012-11-19  0:18 ` NeilBrown [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=20121119111800.08edee0c@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=lukasz.dorau@intel.com \
    --cc=maciej.patelczyk@intel.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