Skip to contentSkip to conversation

Patch fs/xfs/xfs_alloc.c

PATCH Poyo VL 3 participants 4 messages Sep 1, 2010 – Sep 16, 2010

lore
Share & tools
lore

Poyo VL

author
#0 lore raw

File: fs/xfs/xfs_alloc.c
Kernel: 2.6.35.4

It is not an important patch, but I got some warnings:

fs/xfs/xfs_alloc.c: In function ‘xfs_alloc_ag_vextent_near’:
fs/xfs/xfs_alloc.c:694:15: warning: ‘ltlena’ may be used uninitialized in this function
fs/xfs/xfs_alloc.c:683:15: warning: ‘gtlena’ may be used uninitialized in this function

And I hate warnings.

So I initialized that structures with 0. I attached the "patch".

Sorry, I am not a C or a kernel expert. But I try do something usefull :)

I am sorry If I did something wrong and thanks for your time.

Ionut Gabriel Popescu

xfs_alloc_2.c renamed from xfs_alloc.c +2 -2
@@ -680,7 +680,7 @@
 	xfs_agblock_t	gtbnoa;		/* aligned ... */
 	xfs_extlen_t	gtdiff;		/* difference to right side entry */
 	xfs_extlen_t	gtlen;		/* length of right side entry */
-	xfs_extlen_t	gtlena;		/* aligned ... */
+	xfs_extlen_t	gtlena = {0};		/* aligned ... */
 	xfs_agblock_t	gtnew;		/* useful start bno of right side */
 	int		error;		/* error code */
 	int		i;		/* result code, temporary */
@@ -691,7 +691,7 @@
 	/*REFERENCED*/
 	xfs_agblock_t	ltend;		/* end bno of left side entry */
 	xfs_extlen_t	ltlen;		/* length of left side entry */
-	xfs_extlen_t	ltlena;		/* aligned ... */
+	xfs_extlen_t	ltlena = {0};		/* aligned ... */
 	xfs_agblock_t	ltnew;		/* useful start bno of left side */
 	xfs_extlen_t	rlen;		/* length of returned extent */
 #if defined(DEBUG) && defined(__KERNEL__)

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 10 lines · Poyo VL

File: fs/xfs/xfs_alloc.c
Kernel: 2.6.35.4

It is not an important patch, but I got some warnings:

fs/xfs/xfs_alloc.c: In function ‘xfs_alloc_ag_vextent_near’:
fs/xfs/xfs_alloc.c:694:15: warning: ‘ltlena’ may be used uninitialized in this function
fs/xfs/xfs_alloc.c:683:15: warning: ‘gtlena’ may be used uninitialized in this function

I don't see this. What compiler version are you using?

Also, for posting patches, you might want to read and follow Documentation/SubmittingPatches.txt. At minimum, you need to include a Signed-off-by tag (we can't accept patches without that) and attach your patches as plain text.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#2 lore raw

Im using "gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE Linux)"

Before compiling kernel (2.6.35.4) I selected from menuconfig all XFS "options":
Quota supprt, POSIX ACL support, Realtime subvolume support and Debugging support. I saved the .config and I typed "make".

I got the following warnings:

fs/xfs/xfs_alloc.c: In function ‘xfs_alloc_ag_vextent_near’:
fs/xfs/xfs_alloc.c:694:15: warning: ‘ltlena’ may be used uninitialized in this function
fs/xfs/xfs_alloc.c:683:15: warning: ‘gtlena’ may be used uninitialized in this function

So I tried to initialize those variables (structures) with 0.

Sorry, I am not neither a C, nor a kernel expert.

"Patch":

xfs_alloc_2.c 2010-09-01 22:01:32.400007466 +0300 renamed from xfs_alloc.c 2010-09-01 22:00:50.044004253 +0300 +2 -2
@@ -680,7 +680,7 @@
     xfs_agblock_t    gtbnoa;        /* aligned ... */
     xfs_extlen_t    gtdiff;        /* difference to right side entry */
     xfs_extlen_t    gtlen;        /* length of right side entry */
-    xfs_extlen_t    gtlena;        /* aligned ... */
+    xfs_extlen_t    gtlena = {0};        /* aligned ... */
     xfs_agblock_t    gtnew;        /* useful start bno of right side */
     int        error;        /* error code */
     int        i;        /* result code, temporary */
@@ -691,7 +691,7 @@
     /*REFERENCED*/
     xfs_agblock_t    ltend;        /* end bno of left side entry */
     xfs_extlen_t    ltlen;        /* length of left side entry */
-    xfs_extlen_t    ltlena;        /* aligned ... */
+    xfs_extlen_t    ltlena = {0};        /* aligned ... */
     xfs_agblock_t    ltnew;        /* useful start bno of left side */
     xfs_extlen_t    rlen;        /* length of returned extent */
 #if defined(DEBUG) && defined(__KERNEL__)

Thank you for your time.

----- Original Message ----
From: Dave Chinner <[email protected]>
To: Poyo VL <[email protected]>
Cc: [email protected]; [email protected]
Sent: Thu, September 2, 2010 8:21:06 AM
Subject: Re: Patch fs/xfs/xfs_alloc.c

Quoted 5 lines · Poyo VL

File: fs/xfs/xfs_alloc.c
Kernel: 2.6.35.4

It is not an important patch, but I got some warnings:

Quoted 7 lines

fs/xfs/xfs_alloc.c: In function ‘xfs_alloc_ag_vextent_near’:
fs/xfs/xfs_alloc.c:694:15: warning: ‘ltlena’ may be used uninitialized in this

function
fs/xfs/xfs_alloc.c:683:15: warning: ‘gtlena’ may be used uninitialized in this

function

I don't see this. What compiler version are you using?

Also, for posting patches, you might want to read and follow Documentation/SubmittingPatches.txt. At minimum, you need to include a Signed-off-by tag (we can't accept patches without that) and attach your patches as plain text.

Cheers,

Dave.

Signature · 11 lines
Dave Chinner
[email protected]



      

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by
#3 lore raw
Quoted 16 lines · Poyo VL

Im using "gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE Linux)"

Before compiling kernel (2.6.35.4) I selected from menuconfig all XFS "options":
Quota supprt, POSIX ACL support, Realtime subvolume support and Debugging support. I saved the .config and I typed "make".

I got the following warnings:

fs/xfs/xfs_alloc.c: In function ‘xfs_alloc_ag_vextent_near’:
fs/xfs/xfs_alloc.c:694:15: warning: ‘ltlena’ may be used uninitialized in this function
fs/xfs/xfs_alloc.c:683:15: warning: ‘gtlena’ may be used uninitialized in this function

Quoted 3 lines

So I tried to initialize those variables (structures) with 0.

Sorry, I am not neither a C, nor a kernel expert.

I'm going to take this in (to top-of-tree), but I'll be modifying it slightly (xfs_extlen_t is not a struct, so I'll initialize with a simple 0). It may well be that these variables never get used without being set, but it's not at all clear from a quick look so this is a simple fix.

Thanks for reporting the warning.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs