Re: [PATCH 1/6] DDF: ddf_activate_spare: fix gcc -O2 uninitialized warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 16 Aug 2013 20:21:55 +0200 mwilck@xxxxxxxx wrote:

> The warning is spurious, but will break compilation with -O2.
> 
> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
> ---
>  super-ddf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/super-ddf.c b/super-ddf.c
> index e3b3dca..95972ad 100644
> --- a/super-ddf.c
> +++ b/super-ddf.c
> @@ -4779,7 +4779,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
>  	struct ddf_super *ddf = a->container->sb;
>  	int global_ok = 0;
>  	struct mdinfo *rv = NULL;
> -	struct mdinfo *di;
> +	struct mdinfo *di = NULL;
>  	struct metadata_update *mu;
>  	struct dl *dl;
>  	int i;

I fixed this differently as below.
Thanks,
NeilBrown

From bb925ff08beda785d42f5ff8a0f082d91c5caad4 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@xxxxxxx>
Date: Fri, 16 Aug 2013 20:21:55 +0200
Subject: [PATCH] DDF: ddf_activate_spare: fix gcc -O2 uninitialized warning

At this point 'di' and 'rv' both have the same value.  gcc doesn't
realise that and a human reader might not either.
'rv' makes more sense too, so use that.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/super-ddf.c b/super-ddf.c
index e3b3dca..ee6499a 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -4959,7 +4959,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
 	 * Create a metadata_update record to update the
 	 * phys_refnum and lba_offset values
 	 */
-	vc = find_vdcr(ddf, a->info.container_member, di->disk.raid_disk,
+	vc = find_vdcr(ddf, a->info.container_member, rv->disk.raid_disk,
 		       &n_bvd, &vcl);
 	if (vc == NULL)
 		return NULL;

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux