rhashtable: Fix use before NULL check in bucket_table_free
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 25 Feb 2017 14:38:11 +0000 (22:38 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Feb 2017 02:32:57 +0000 (21:32 -0500)
Dan Carpenter reported a use before NULL check bug in the function
bucket_table_free.  In fact we don't need the NULL check at all as
no caller can provide a NULL argument.  So this patch fixes this by
simply removing it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/rhashtable.c

index 172454e6b979e935ef0d184953b6c35b06c32592..fac1a78afb3917d63cd8ac39e6aa938116ea5167 100644 (file)
@@ -146,9 +146,7 @@ static void bucket_table_free(const struct bucket_table *tbl)
        if (tbl->nest)
                nested_bucket_table_free(tbl);
 
-       if (tbl)
-               kvfree(tbl->locks);
-
+       kvfree(tbl->locks);
        kvfree(tbl);
 }