* [PATCH -next] netlink: Use the BITS_PER_LONG macro
@ 2024-09-02 11:10 Jinjie Ruan
2024-09-03 1:39 ` Jakub Kicinski
0 siblings, 1 reply; 4+ messages in thread
From: Jinjie Ruan @ 2024-09-02 11:10 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, christophe.jaillet, horms, netdev
Cc: ruanjinjie
sizeof(unsigned long) * 8 is the number of bits in an unsigned long
variable, replace it with BITS_PER_LONG macro to make it simpler.
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
net/netlink/af_netlink.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h
index 5b0e4e62ab8b..e369980e30e3 100644
--- a/net/netlink/af_netlink.h
+++ b/net/netlink/af_netlink.h
@@ -19,7 +19,7 @@ enum {
NETLINK_F_STRICT_CHK,
};
-#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
+#define NLGRPSZ(x) (ALIGN(x, BITS_PER_LONG) / 8)
#define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long))
struct netlink_sock {
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] netlink: Use the BITS_PER_LONG macro
2024-09-02 11:10 [PATCH -next] netlink: Use the BITS_PER_LONG macro Jinjie Ruan
@ 2024-09-03 1:39 ` Jakub Kicinski
2024-09-03 2:06 ` Jinjie Ruan
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2024-09-03 1:39 UTC (permalink / raw)
To: Jinjie Ruan; +Cc: davem, edumazet, pabeni, christophe.jaillet, horms, netdev
On Mon, 2 Sep 2024 19:10:52 +0800 Jinjie Ruan wrote:
> sizeof(unsigned long) * 8 is the number of bits in an unsigned long
> variable, replace it with BITS_PER_LONG macro to make it simpler.
Does coccicheck catch such cases?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] netlink: Use the BITS_PER_LONG macro
2024-09-03 1:39 ` Jakub Kicinski
@ 2024-09-03 2:06 ` Jinjie Ruan
2024-09-03 16:12 ` Jakub Kicinski
0 siblings, 1 reply; 4+ messages in thread
From: Jinjie Ruan @ 2024-09-03 2:06 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, edumazet, pabeni, christophe.jaillet, horms, netdev
On 2024/9/3 9:39, Jakub Kicinski wrote:
> On Mon, 2 Sep 2024 19:10:52 +0800 Jinjie Ruan wrote:
>> sizeof(unsigned long) * 8 is the number of bits in an unsigned long
>> variable, replace it with BITS_PER_LONG macro to make it simpler.
>
> Does coccicheck catch such cases?
Yes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] netlink: Use the BITS_PER_LONG macro
2024-09-03 2:06 ` Jinjie Ruan
@ 2024-09-03 16:12 ` Jakub Kicinski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2024-09-03 16:12 UTC (permalink / raw)
To: Jinjie Ruan; +Cc: davem, edumazet, pabeni, christophe.jaillet, horms, netdev
On Tue, 3 Sep 2024 10:06:02 +0800 Jinjie Ruan wrote:
> > Does coccicheck catch such cases?
>
> Yes
which script?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-03 16:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 11:10 [PATCH -next] netlink: Use the BITS_PER_LONG macro Jinjie Ruan
2024-09-03 1:39 ` Jakub Kicinski
2024-09-03 2:06 ` Jinjie Ruan
2024-09-03 16:12 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).