mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: Protect INET_ADDR_COOKIE on 32-bit architectures
@ 2020-04-28  7:52 Stephen Kitt
  2020-04-28 21:07 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Kitt @ 2020-04-28  7:52 UTC (permalink / raw)
  To: David S . Miller, Joe Perches, Jakub Kicinski, netdev
  Cc: linux-kernel, Stephen Kitt

Commit c7228317441f ("net: Use a more standard macro for
INET_ADDR_COOKIE") added a __deprecated marker to the cookie name on
32-bit architectures, with the intent that the compiler would flag
uses of the name. However since commit 771c035372a0 ("deprecate the
'__deprecated' attribute warnings entirely and for good"),
__deprecated doesn't do anything and should be avoided.

This patch changes INET_ADDR_COOKIE to declare a dummy typedef (so it
makes checkpatch.pl complain, sorry...) so that any subsequent use of
the cookie's name will in all likelihood break the build. It also
removes the __deprecated marker.

Signed-off-by: Stephen Kitt <steve@sk2.org>
---
 include/net/inet_hashtables.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index ad64ba6a057f..8a1391d82406 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -301,8 +301,9 @@ static inline struct sock *inet_lookup_listener(struct net *net,
 	  ((__sk)->sk_bound_dev_if == (__sdif)))		&&	\
 	 net_eq(sock_net(__sk), (__net)))
 #else /* 32-bit arch */
+/* Break the build if anything tries to use the cookie's name. */
 #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
-	const int __name __deprecated __attribute__((unused))
+	typedef void __name __attribute__((unused))
 
 #define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif, __sdif) \
 	(((__sk)->sk_portpair == (__ports))		&&		\
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: Protect INET_ADDR_COOKIE on 32-bit architectures
  2020-04-28  7:52 [PATCH] net: Protect INET_ADDR_COOKIE on 32-bit architectures Stephen Kitt
@ 2020-04-28 21:07 ` David Miller
  2020-05-08 12:02   ` Stephen Kitt
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2020-04-28 21:07 UTC (permalink / raw)
  To: steve; +Cc: joe, kuba, netdev, linux-kernel

From: Stephen Kitt <steve@sk2.org>
Date: Tue, 28 Apr 2020 09:52:31 +0200

> This patch changes INET_ADDR_COOKIE to declare a dummy typedef (so it
> makes checkpatch.pl complain, sorry...)

This is trading one problem for another, so in the end doesn't really
move us forward.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: Protect INET_ADDR_COOKIE on 32-bit architectures
  2020-04-28 21:07 ` David Miller
@ 2020-05-08 12:02   ` Stephen Kitt
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Kitt @ 2020-05-08 12:02 UTC (permalink / raw)
  To: David Miller; +Cc: joe, kuba, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

On Tue, 28 Apr 2020 14:07:46 -0700 (PDT), David Miller <davem@davemloft.net>
wrote:
> From: Stephen Kitt <steve@sk2.org>
> Date: Tue, 28 Apr 2020 09:52:31 +0200
> 
> > This patch changes INET_ADDR_COOKIE to declare a dummy typedef (so it
> > makes checkpatch.pl complain, sorry...)  
> 
> This is trading one problem for another, so in the end doesn't really
> move us forward.

Right, a dummy struct is probably better, I’ll send a v2.

Regards,

Stephen

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-08 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28  7:52 [PATCH] net: Protect INET_ADDR_COOKIE on 32-bit architectures Stephen Kitt
2020-04-28 21:07 ` David Miller
2020-05-08 12:02   ` Stephen Kitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®