fs/xfs: Correct NULL test
authorJulia Lawall <julia@diku.dk>
Sat, 6 Feb 2010 08:45:15 +0000 (08:45 +0000)
committerAlex Elder <aelder@sgi.com>
Sat, 13 Feb 2010 19:22:53 +0000 (13:22 -0600)
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@diku.dk>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
fs/xfs/quota/xfs_qm.c

index 8699e51cb45e8011e2da8ba3e842d26e74bb4eec..417e61e3d9dda0f18434498e51252fd08eca0473 100644 (file)
@@ -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);