[ovs-dev] [PATCH 06/11] packets: Fix possible null pointer argument to memmove.

William Tu u9012063 at gmail.com
Sat Oct 28 17:31:53 UTC 2017


Clang reports possible null pointer to memmove due to
dp_packet_data might retun null.  Fix it by adding
ovs_assert check.

Signed-off-by: William Tu <u9012063 at gmail.com>
---
 lib/packets.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/packets.c b/lib/packets.c
index 74d87eda89e1..230a62553ff6 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -397,6 +397,7 @@ pop_mpls(struct dp_packet *packet, ovs_be16 ethtype)
             dp_packet_set_l2_5(packet, NULL);
         }
         /* Shift the l2 header forward. */
+        ovs_assert(dp_packet_data(packet));
         memmove((char*)dp_packet_data(packet) + MPLS_HLEN, dp_packet_data(packet), len);
         dp_packet_resize_l2_5(packet, -MPLS_HLEN);
     }
-- 
2.7.4



More information about the dev mailing list