mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +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:
committed by
Ilya Maximets
parent
40546cd6e5
commit
bc79a7bf03
@@ -147,6 +147,8 @@ odp_set_ipv4(struct dp_packet *packet, const struct ovs_key_ipv4 *key,
|
||||
uint8_t new_tos;
|
||||
uint8_t new_ttl;
|
||||
|
||||
ovs_assert(nh);
|
||||
|
||||
if (mask->ipv4_src) {
|
||||
ip_src_nh = get_16aligned_be32(&nh->ip_src);
|
||||
new_ip_src = key->ipv4_src | (ip_src_nh & ~mask->ipv4_src);
|
||||
@@ -287,6 +289,8 @@ set_arp(struct dp_packet *packet, const struct ovs_key_arp *key,
|
||||
{
|
||||
struct arp_eth_header *arp = dp_packet_l3(packet);
|
||||
|
||||
ovs_assert(arp);
|
||||
|
||||
if (!mask) {
|
||||
arp->ar_op = key->arp_op;
|
||||
arp->ar_sha = key->arp_sha;
|
||||
|
Reference in New Issue
Block a user