Skip to content

Commit

Permalink
lib/stackdepot.c: use array_size() helper in jhash2()
Browse files Browse the repository at this point in the history
Use array_size() helper instead of the open-coded version in jhash2().
These sorts of multiplication factors need to be wrapped in array_size().

Also, use the preferred form for passing the size of an object type.

Link: https://lkml.kernel.org/r/cb8a682e4bba4dbddd2bd8aca7f8c02fea89639b.1601565471.git.gustavoars@kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Gustavo A. R. Silva authored and Linus Torvalds committed Dec 16, 2020
1 parent 47e684a commit 180644f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/stackdepot.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ static struct stack_record *stack_table[STACK_HASH_SIZE] = {
static inline u32 hash_stack(unsigned long *entries, unsigned int size)
{
return jhash2((u32 *)entries,
size * sizeof(unsigned long) / sizeof(u32),
STACK_HASH_SEED);
array_size(size, sizeof(*entries)) / sizeof(u32),
STACK_HASH_SEED);
}

/* Use our own, non-instrumented version of memcmp().
Expand Down

0 comments on commit 180644f

Please sign in to comment.