Skip to content

Commit

Permalink
rhashtable: Fix use before NULL check in bucket_table_free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Feb 27, 2017
1 parent 37f1c63 commit ca43540
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit ca43540

Please sign in to comment.