Skip to content

Commit

Permalink
rtnetlink: avoid 0 sized arrays
Browse files Browse the repository at this point in the history
Arrays (when not in a struct) "shall have a value greater than zero".

GCC complains when it's not the case here.

Fixes: ba7d49b ("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>
  • Loading branch information
Sasha Levin authored and David S. Miller committed Feb 24, 2015
1 parent 7775142 commit 4e10fd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2012,8 +2012,8 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
}

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;
Expand Down

0 comments on commit 4e10fd5

Please sign in to comment.