xfs
[Top] [All Lists]

[PATCH 11/11] fs/xfs: Correct NULL test

To: Alex Elder <aelder@xxxxxxx>, xfs-masters@xxxxxxxxxxx, xfs@xxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, kernel-janitors@xxxxxxxxxxxxxxx
Subject: [PATCH 11/11] fs/xfs: Correct NULL test
From: Julia Lawall <julia@xxxxxxx>
Date: Sat, 6 Feb 2010 09:45:15 +0100 (CET)
From: Julia Lawall <julia@xxxxxxx>

Test the value that was just allocated rather than the previously tested one.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r@
expression *x;
expression e;
identifier l;
@@

if (x == NULL || ...) {
    ... when forall
    return ...; }
... when != goto l;
    when != x = e
    when != &x
*x == NULL
// </smpl>

Signed-off-by: Julia Lawall <julia@xxxxxxx>

---
 fs/xfs/quota/xfs_qm.c               |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 11cfd82..4318cd5 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -123,7 +123,7 @@ xfs_Gqm_init(void)
                goto out;
 
        gdqhash = kmem_zalloc_large(hsize);
-       if (!udqhash)
+       if (!gdqhash)
                goto out_free_udqhash;
 
        hsize /= sizeof(xfs_dqhash_t);

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