Skip to contentSkip to conversation

net: sched: cls_u32: use hash_ptr() for tc_u_hash

PATCH Applied Arnd Bergmann 3 participants 3 messages Oct 18, 2017 – Oct 20, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sched: cls_u32: use hash_ptr() for tc_u_hash

After the change to the tp hash, we now get a build warning on 32-bit architectures:

net/sched/cls_u32.c: In function 'tc_u_hash':
net/sched/cls_u32.c:338:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
return hash_64((u64) tp->chain->block, U32_HASH_SHIFT);

Using hash_ptr() instead of hash_64() lets us drop the cast and fixes the warning while still resulting in the same hash value.

Fixes 7fa9d974f3c2 ("net: sched: cls_u32: use block instead of q in tc_u_common")
---
 net/sched/cls_u32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_u32.c +1 -1
index b6d46065f661..49d96b45a8ce 100644
@@ -335,7 +335,7 @@ static struct hlist_head *tc_u_common_hash;
 
 static unsigned int tc_u_hash(const struct tcf_proto *tp)
 {
-	return hash_64((u64) tp->chain->block, U32_HASH_SHIFT);
+	return hash_ptr(tp->chain->block, U32_HASH_SHIFT);
 }
 
 static struct tc_u_common *tc_u_common_find(const struct tcf_proto *tp)
Signature · 1 line
2.9.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Wed, Oct 18, 2017 at 10:33:37AM CEST, [email protected] wrote:

After the change to the tp hash, we now get a build warning on 32-bit architectures:

net/sched/cls_u32.c: In function 'tc_u_hash':
net/sched/cls_u32.c:338:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
return hash_64((u64) tp->chain->block, U32_HASH_SHIFT);

Quoted 6 lines

Using hash_ptr() instead of hash_64() lets us drop the cast and fixes the warning while still resulting in the same hash value.

Fixes 7fa9d974f3c2 ("net: sched: cls_u32: use block instead of q in tc_u_common")

Thanks.

maintainer Applied
#2 lore raw
In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Wed, 18 Oct 2017 10:33:37 +0200

Quoted 7 lines

After the change to the tp hash, we now get a build warning on 32-bit architectures:

net/sched/cls_u32.c: In function 'tc_u_hash':
net/sched/cls_u32.c:338:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
return hash_64((u64) tp->chain->block, U32_HASH_SHIFT);

Quoted 6 lines

Using hash_ptr() instead of hash_64() lets us drop the cast and fixes the warning while still resulting in the same hash value.

Fixes 7fa9d974f3c2 ("net: sched: cls_u32: use block instead of q in tc_u_common")

Applied.