[PATCH 3/3] xfs: zero allocation_args on the kernel stack

tinguely
2012-09-19T16:33:55Z

[-- Attachment #1: 3-3-xfs-zero_allocation_args.patch --]
[-- Type: text/plain, Size: 1368 bytes --]

The allocation argument structures is created on the kernel stack space. This
patch makes sure the userdata variable is always initialized.

The better solution is always memset to 0 or "= { 0 }" the xfs_alloc_arg
and xfs_bmalloca structures. I believe there will only be 4 places that need
this memset change.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
fs/xfs/xfs_bmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/fs/xfs/xfs_bmap.c
===================================================================
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -3096,7 +3096,7 @@ xfs_bmap_extents_to_btree(
}
args.minlen = args.maxlen = args.prod = 1;
args.total = args.minleft = args.alignment = args.mod = args.isfl =
- args.minalignslop = 0;
+ args.minalignslop = args.userdata = 0;
args.wasdel = wasdel;
*logflagsp = 0;
if ((error = xfs_alloc_vextent(&args))) {
@@ -3254,7 +3254,7 @@ xfs_bmap_local_to_extents(
}
args.total = total;
args.mod = args.minleft = args.alignment = args.wasdel =
- args.isfl = args.minalignslop = 0;
+ args.isfl = args.minalignslop = args.userdata = 0;
args.minlen = args.maxlen = args.prod = 1;
if ((error = xfs_alloc_vextent(&args)))
goto done;