projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
47e684a
)
lib/stackdepot.c: use array_size() helper in jhash2()
author
Gustavo A. R. Silva
<gustavoars@kernel.org>
Wed, 16 Dec 2020 04:43:10 +0000
(20:43 -0800)
committer
Linus Torvalds
<torvalds@linux-foundation.org>
Wed, 16 Dec 2020 06:46:16 +0000
(22:46 -0800)
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>
lib/stackdepot.c
patch
|
blob
|
history
diff --git
a/lib/stackdepot.c
b/lib/stackdepot.c
index 683b6a8ddade15b9f788bf86ed92a9ed71d3703f..890dcc2e984e363268939d2b678a3d5f117b7e56 100644
(file)
--- a/
lib/stackdepot.c
+++ b/
lib/stackdepot.c
@@
-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().