[PATCH 071/102] net: fix *_DIAG_MAX constants

Luis Henriques luis.henriques at canonical.com
Mon Apr 8 09:50:26 UTC 2013


3.5.7.10 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andrey Vagin <avagin at openvz.org>

commit ae5fc98728c8bbbd6d7cab0b9781671fc4419c1b upstream.

Follow the common pattern and define *_DIAG_MAX like:

        [...]
        __XXX_DIAG_MAX,
};

Because everyone is used to do:

        struct nlattr *attrs[XXX_DIAG_MAX+1];

        nla_parse([...], XXX_DIAG_MAX, [...]

Reported-by: Thomas Graf <tgraf at suug.ch>
Cc: "David S. Miller" <davem at davemloft.net>
Cc: Pavel Emelyanov <xemul at parallels.com>
Cc: Eric Dumazet <edumazet at google.com>
Cc: "Paul E. McKenney" <paulmck at linux.vnet.ibm.com>
Cc: David Howells <dhowells at redhat.com>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: David S. Miller <davem at davemloft.net>
[ luis: backport to 3.5:
  - fix unix_diag.h path
  - packet_diag.h does not exist ]
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 include/linux/unix_diag.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h
index b1d2bf1..0ff4d32 100644
--- a/include/linux/unix_diag.h
+++ b/include/linux/unix_diag.h
@@ -38,9 +38,11 @@ enum {
 	UNIX_DIAG_RQLEN,
 	UNIX_DIAG_MEMINFO,
 
-	UNIX_DIAG_MAX,
+	__UNIX_DIAG_MAX,
 };
 
+#define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1)
+
 struct unix_diag_vfs {
 	__u32	udiag_vfs_ino;
 	__u32	udiag_vfs_dev;
-- 
1.8.1.2





More information about the kernel-team mailing list