xfs
[Top] [All Lists]

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

To: xfs@xxxxxxxxxxx
Subject: [PATCH 3/3] xfs: zero allocation_args on the kernel stack
From: tinguely@xxxxxxx
Date: Wed, 19 Sep 2012 11:31:36 -0500
References: <20120919163133.097340199@xxxxxxx>
User-agent: quilt/0.51-1
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@xxxxxxx>
---
 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;


<Prev in Thread] Current Thread [Next in Thread>