Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

0 views
Skip to first unread message

Julia Lawall

unread,
Feb 6, 2010, 3:50:02 AM2/6/10
to
From: Julia Lawall <ju...@diku.dk>

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 <ju...@diku.dk>

---
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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Christoph Hellwig

unread,
Feb 8, 2010, 2:40:02 PM2/8/10
to
On Sat, Feb 06, 2010 at 09:45:15AM +0100, Julia Lawall wrote:
> 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;

Thanks, this looks correct,


Reviewed-by: Christoph Hellwig <h...@lst.de>

0 new messages