* [PATCH] rtnetlink: avoid 0 sized arrays
@ 2015-02-24 19:14 Sasha Levin
2015-02-24 20:39 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2015-02-24 19:14 UTC (permalink / raw)
To: linux-kernel
Cc: Sasha Levin, David S. Miller, Nicolas Dichtel, Jiri Pirko,
Thomas Graf, Jamal Hadi Salim, Roopa Prabhu, Cong Wang,
Daniel Borkmann, open list:NETWORKING [GENERAL]
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(-)
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;
--
1.7.10.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rtnetlink: avoid 0 sized arrays
2015-02-24 19:14 [PATCH] rtnetlink: avoid 0 sized arrays Sasha Levin
@ 2015-02-24 20:39 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-24 20:39 UTC (permalink / raw)
To: sasha.levin
Cc: linux-kernel, nicolas.dichtel, jiri, tgraf, jhs, roopa, cwang,
daniel, netdev
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-24 20:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-24 19:14 [PATCH] rtnetlink: avoid 0 sized arrays Sasha Levin
2015-02-24 20:39 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®