Skip to content

Commit

Permalink
fs/xfs: Correct NULL test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Alex Elder committed Feb 13, 2010
1 parent 180040b commit d67b1b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/xfs/quota/xfs_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d67b1b0

Please sign in to comment.