diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-04-15 08:56:03 -0400 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-04-15 09:01:56 -0400 | 
| commit | fd3f8e52b673bbf695ded218d3f566826fa1ce3f (patch) | |
| tree | e02df9aca270a1726f51b05e2a9e59992fd52b49 /zebra/kernel_netlink.h | |
| parent | 260616d55d96fab302c678ee78e0a58ca60b0aa1 (diff) | |
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/kernel_netlink.h')
| -rw-r--r-- | zebra/kernel_netlink.h | 2 | 
1 files changed, 1 insertions, 1 deletions
diff --git a/zebra/kernel_netlink.h b/zebra/kernel_netlink.h index 076ca5c5c7..6a4077abf6 100644 --- a/zebra/kernel_netlink.h +++ b/zebra/kernel_netlink.h @@ -68,7 +68,7 @@ int netlink_talk_info(int (*filter)(struct nlmsghdr *, ns_id_t, int startup),  		      struct nlmsghdr *n,  		      const struct zebra_dplane_info *dp_info, int startup); -extern int netlink_request(struct nlsock *nl, struct nlmsghdr *n); +extern int netlink_request(struct nlsock *nl, void *req);  #endif /* HAVE_NETLINK */  | 
