Thread (7 messages) 7 messages, 5 authors, 2023-06-02

Re: [PATCH linux] net/ipv4: ping_group_range: allow GID from 2147483648 to 4294967294

From: Akihiro Suda <hidden>
Date: 2023-06-02 13:03:58
Also in: lkml

2023年6月2日(金) 19:51 David Laight [off-list ref]:
From: Kuniyuki Iwashima
quoted
Sent: 01 June 2023 00:00
....
quoted
quoted
quoted
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -20,7 +20,7 @@
  * gid_t is either uint or ushort.  We want to pass it to
  * proc_dointvec_minmax(), so it must not be larger than MAX_INT
  */
-#define GID_T_MAX (((gid_t)~0U) >> 1)
+#define GID_T_MAX ((gid_t)~0U)
Doesn't that comment need updating?

I do wonder how much code breaks for gid > MAXINT.
How much testing does it actually get??
It is fixed in v3:
https://patchwork.kernel.org/project/netdevbpf/patch/20230601031305.55901-1-akihiro.suda.cz@hco.ntt.co.jp/
-/*
- * gid_t is either uint or ushort.  We want to pass it to
- * proc_dointvec_minmax(), so it must not be larger than MAX_INT
- */
-#define GID_T_MAX (((gid_t)~0U) >> 1)
+#define GID_T_MAX (((gid_t)~0U) - 1)
Tested with 4294967294, 4294967295 (EINVAL), and 4294967296 (EINVAL), on x86_64.



        David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help