Re: [PATCH] Grow.c: fix uninitialized variables compilation-time error

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

 



On Tue, 13 Nov 2012 13:29:43 +0100 Lukasz Dorau <lukasz.dorau@xxxxxxxxx>
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@xxxxxxxxx>
> ---
>  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: 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