lkml.org 
[lkml]   [2019]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] hugetlb: Fix clang compilation warning
Date
Building the kernel with a recent version of clang I noticed the warning
below:

mm/hugetlb.c:4055:40: warning: expression does not compute the number of
elements in this array; element type is 'unsigned long', not 'u32'
(aka 'unsigned int') [-Wsizeof-array-div]
hash = jhash2((u32 *)&key, sizeof(key)/sizeof(u32), 0);
~~~ ^
mm/hugetlb.c:4049:16: note: array 'key' declared here
unsigned long key[2];
^
mm/hugetlb.c:4055:40: note: place parentheses around the 'sizeof(u32)'
expression to silence this warning
hash = jhash2((u32 *)&key, sizeof(key)/sizeof(u32), 0);
^ CC fs/ext4/ialloc.o

Fix the warning adding parentheses around the sizeof(u32) expression.

Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
mm/hugetlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ef37c85423a5..ce9ff2b35962 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4052,7 +4052,7 @@ u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping,
key[0] = (unsigned long) mapping;
key[1] = idx;

- hash = jhash2((u32 *)&key, sizeof(key)/sizeof(u32), 0);
+ hash = jhash2((u32 *)&key, sizeof(key)/(sizeof(u32)), 0);

return hash & (num_fault_mutexes - 1);
}
--
2.23.0
\
 
 \ /
  Last update: 2019-10-16 16:24    [W:0.038 / U:10.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site