diff mbox

rtnetlink: avoid 0 sized arrays

Message ID 1424805277-7914-1-git-send-email-sasha.levin@oracle.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Sasha Levin Feb. 24, 2015, 7:14 p.m. UTC
Arrays (when not in a struct) "shall have a value greater than zero".

GCC complains when it's not the case here.

Fixes: ba7d49b1f0 ("rtnetlink: provide api for getting and setting slave info")
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 net/core/rtnetlink.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Miller Feb. 24, 2015, 8:39 p.m. UTC | #1
From: Sasha Levin <sasha.levin@oracle.com>
Date: Tue, 24 Feb 2015 14:14:35 -0500

> Arrays (when not in a struct) "shall have a value greater than zero".
> 
> GCC complains when it's not the case here.
> 
> Fixes: ba7d49b1f0 ("rtnetlink: provide api for getting and setting slave info")
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ab293a3..1385de0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2012,8 +2012,8 @@  replay:
 	}
 
 	if (1) {
-		struct nlattr *attr[ops ? ops->maxtype + 1 : 0];
-		struct nlattr *slave_attr[m_ops ? m_ops->slave_maxtype + 1 : 0];
+		struct nlattr *attr[ops ? ops->maxtype + 1 : 1];
+		struct nlattr *slave_attr[m_ops ? m_ops->slave_maxtype + 1 : 1];
 		struct nlattr **data = NULL;
 		struct nlattr **slave_data = NULL;
 		struct net *dest_net, *link_net = NULL;