linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Grow.c: fix uninitialized variables compilation-time error
@ 2012-11-13 12:29 Lukasz Dorau
  2012-11-19  0:18 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Dorau @ 2012-11-13 12:29 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, maciej.patelczyk

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);

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Grow.c: fix uninitialized variables compilation-time error
  2012-11-13 12:29 [PATCH] Grow.c: fix uninitialized variables compilation-time error Lukasz Dorau
@ 2012-11-19  0:18 ` NeilBrown
  0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2012-11-19  0:18 UTC (permalink / raw)
  To: Lukasz Dorau; +Cc: linux-raid, maciej.patelczyk

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-19  0:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-13 12:29 [PATCH] Grow.c: fix uninitialized variables compilation-time error Lukasz Dorau
2012-11-19  0:18 ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).