diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-04-15 14:56:03 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-04-15 15:01:56 +0200 |
commit | fd3f8e52b673bbf695ded218d3f566826fa1ce3f (patch) | |
tree | e02df9aca270a1726f51b05e2a9e59992fd52b49 /zebra/rule_netlink.c | |
parent | Merge pull request #6154 from donaldsharp/check_interface_working (diff) | |
download | frr-fd3f8e52b673bbf695ded218d3f566826fa1ce3f.tar.xz frr-fd3f8e52b673bbf695ded218d3f566826fa1ce3f.zip |
zebra: Modify netlink_request to statisfy coverity
The netlink_request function takes a `struct nlmsghdr *`
pointer from a common pattern that we use:
struct {
struct nlmsghdr n;
struct fib_rule_hdr frh;
char buf[NL_PKT_BUF_SIZE];
} req;
We were calling it `netlink_request(Socket, &req.n)`
The problem here is that coverity, rightly so, sees that
we access the data after the nlmsghdr in netlink_request and
tells us we have an read beyond end of the structure. While
we know we haven't mangled anything up here because of manual
inspection coverity doesn't have this knowledge implicitly.
So let's modify the code call to netlink_request to pass in the
void pointer of the req structure itself, cast to the appropriate
data structure in the function and do the right thing. Hopefully
the coverity SA will be happy and we can move on with our life.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/rule_netlink.c')
-rw-r--r-- | zebra/rule_netlink.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c index 07e1902f6..a5a605f27 100644 --- a/zebra/rule_netlink.c +++ b/zebra/rule_netlink.c @@ -355,7 +355,7 @@ static int netlink_request_rules(struct zebra_ns *zns, int family, int type) req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct fib_rule_hdr)); req.frh.family = family; - return netlink_request(&zns->netlink_cmd, &req.n); + return netlink_request(&zns->netlink_cmd, &req); } /* |