rtnetlink: avoid 0 sized arrays
authorSasha Levin <sasha.levin@oracle.com>
Tue, 24 Feb 2015 19:14:35 +0000 (14:14 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Feb 2015 20:39:09 +0000 (15:39 -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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c

index ab293a3066b34bc4f6af71701f0c12b9ab6e5a34..1385de0fa0809828dd4467386c902ef2e718dcae 100644 (file)
@@ -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;