diff options
author | Christian Brauner <christian@brauner.io> | 2018-09-04 22:53:51 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-20 20:45:58 +0300 |
commit | 6cbd0932ab9a8592d03ad7306f796bc765bc2083 (patch) | |
tree | 5df51ceedaf6ac83f7f43e423b890c0d4e76f83d /net/core | |
parent | 4b702fdd6e7e6d7a7e6359857a2c49ffbc891a29 (diff) | |
download | linux-6cbd0932ab9a8592d03ad7306f796bc765bc2083.tar.xz |
rtnetlink: move type calculation out of loop
[ Upstream commit 87ccbb1f943625884b824c5560f635dcea8e4510 ]
I don't see how the type - which is one of
RTM_{GETADDR,GETROUTE,GETNETCONF} - can change. So do the message type
calculation once before entering the for loop.
Signed-off-by: Christian Brauner <christian@brauner.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/rtnetlink.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 95768a9fca06..c0de73b12580 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -3268,13 +3268,13 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb) { int idx; int s_idx = cb->family; + int type = cb->nlh->nlmsg_type - RTM_BASE; if (s_idx == 0) s_idx = 1; for (idx = 1; idx <= RTNL_FAMILY_MAX; idx++) { struct rtnl_link **tab; - int type = cb->nlh->nlmsg_type-RTM_BASE; struct rtnl_link *link; rtnl_dumpit_func dumpit; |