UB Sanitizer report:
lib/dp-packet.h:587:22: runtime error: member access within misaligned
address 0x000001ecde10 for type 'struct dp_packet', which requires 64
byte alignment

    #0 in dp_packet_set_base lib/dp-packet.h:587
    #1 in dp_packet_use__ lib/dp-packet.c:46
    #2 in dp_packet_use lib/dp-packet.c:60
    #3 in dp_packet_init lib/dp-packet.c:126
    #4 in dp_packet_new lib/dp-packet.c:150
    [...]

Signed-off-by: Mike Pattrick <m...@redhat.com>

---
v3:
- used proper free method for non-posix platforms

---
 lib/dp-packet.c | 4 ++++
 lib/dp-packet.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/lib/dp-packet.c b/lib/dp-packet.c
index 61e405460..ae8ab5800 100644
--- a/lib/dp-packet.c
+++ b/lib/dp-packet.c
@@ -146,7 +146,11 @@ dp_packet_uninit(struct dp_packet *b)
 struct dp_packet *
 dp_packet_new(size_t size)
 {
+#ifdef DPDK_NETDEV
+    struct dp_packet *b = xmalloc_cacheline(sizeof *b);
+#else
     struct dp_packet *b = xmalloc(sizeof *b);
+#endif
     dp_packet_init(b, size);
     return b;
 }
diff --git a/lib/dp-packet.h b/lib/dp-packet.h
index ed1e5b3f6..b3e6a5d10 100644
--- a/lib/dp-packet.h
+++ b/lib/dp-packet.h
@@ -257,7 +257,11 @@ dp_packet_delete(struct dp_packet *b)
         }
 
         dp_packet_uninit(b);
+#ifdef DPDK_NETDEV
+        free_cacheline(b);
+#else
         free(b);
+#endif
     }
 }
 
-- 
2.31.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to