2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 23:05:29 +00:00

treewide: Add ovs_assert to check for null pointers.

This patch adds an assortment of `ovs_assert` statements to check for
null pointers. We use assertions since it should be impossible for any
of these pointers to be NULL.

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: James Raphael Tiovalen <jamestiotio@gmail.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
James Raphael Tiovalen
2023-08-04 00:19:12 +08:00
committed by Ilya Maximets
parent 40546cd6e5
commit bc79a7bf03
10 changed files with 20 additions and 3 deletions

View File

@@ -112,7 +112,7 @@ rtnetlink_parse(struct ofpbuf *buf, struct rtnetlink_change *change)
if (parsed) {
const struct ifinfomsg *ifinfo;
ifinfo = ofpbuf_at(buf, NLMSG_HDRLEN, sizeof *ifinfo);
ifinfo = ofpbuf_at_assert(buf, NLMSG_HDRLEN, sizeof *ifinfo);
/* Wireless events can be spammy and cause a
* lot of unnecessary churn and CPU load in
@@ -175,7 +175,7 @@ rtnetlink_parse(struct ofpbuf *buf, struct rtnetlink_change *change)
if (parsed) {
const struct ifaddrmsg *ifaddr;
ifaddr = ofpbuf_at(buf, NLMSG_HDRLEN, sizeof *ifaddr);
ifaddr = ofpbuf_at_assert(buf, NLMSG_HDRLEN, sizeof *ifaddr);
change->nlmsg_type = nlmsg->nlmsg_type;
change->if_index = ifaddr->ifa_index;