UB Sanitizer report:
  lib/dpif-netdev.c:6758:13: runtime error: member access within misaligned 
address 0x7f7f24d25010 for type 'struct dp_netdev_pmd_thread', which requires 
64 byte alignment
  0x7f7f24d25010: note: pointer points here
   00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 
00 00 00 00  00 00 00 00
                ^
     #0 0x5fbfde in dp_netdev_configure_pmd lib/dpif-netdev.c:6758
     #1 0x5fbde9 in dp_netdev_set_nonpmd lib/dpif-netdev.c:6715
     #2 0x5d6fdd in create_dp_netdev lib/dpif-netdev.c:1769
     #3 0x5d72d0 in dpif_netdev_open lib/dpif-netdev.c:1807
     #4 0x61c83f in do_open lib/dpif.c:347
     [...]
  lib/dpif-netdev.c:1724:6: runtime error: member access within misaligned 
address 0x000002005eb0 for type 'struct dp_netdev', which requires 64 byte 
alignment
  0x000002005eb0: note: pointer points here
   00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 
00 00 00 00  00 00 00 00
                ^
      #0 0x5d6660 in create_dp_netdev lib/dpif-netdev.c:1724
      #1 0x5d72d0 in dpif_netdev_open lib/dpif-netdev.c:1807
      #2 0x61c846 in do_open lib/dpif.c:347
      #3 0x61ca9c in dpif_create lib/dpif.c:402
      #4 0x61cac9 in dpif_create_and_open lib/dpif.c:415
      #5 0x48f235 in open_dpif_backer ofproto/ofproto-dpif.c:776
      [...]

Signed-off-by: Dumitru Ceara <[email protected]>
---
 lib/dpif-netdev.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index f62202a8b53d..25d8a3ff2009 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1718,7 +1718,7 @@ create_dp_netdev(const char *name, const struct 
dpif_class *class,
         ovsthread_once_done(&tsc_freq_check);
     }
 
-    dp = xzalloc(sizeof *dp);
+    dp = xzalloc_cacheline(sizeof *dp);
     shash_add(&dp_netdevs, name, dp);
 
     *CONST_CAST(const struct dpif_class **, &dp->class) = class;
@@ -1888,7 +1888,7 @@ dp_netdev_free(struct dp_netdev *dp)
 
     free(dp->pmd_cmask);
     free(CONST_CAST(char *, dp->name));
-    free(dp);
+    free_cacheline(dp);
 }
 
 static void
@@ -5672,7 +5672,7 @@ reconfigure_pmd_threads(struct dp_netdev *dp)
         if (!pmd) {
             struct ds name = DS_EMPTY_INITIALIZER;
 
-            pmd = xzalloc(sizeof *pmd);
+            pmd = xzalloc_cacheline(sizeof *pmd);
             dp_netdev_configure_pmd(pmd, dp, core->core_id, core->numa_id);
 
             ds_put_format(&name, "pmd-c%02d/id:", core->core_id);
@@ -6713,7 +6713,7 @@ dp_netdev_set_nonpmd(struct dp_netdev *dp)
 {
     struct dp_netdev_pmd_thread *non_pmd;
 
-    non_pmd = xzalloc(sizeof *non_pmd);
+    non_pmd = xzalloc_cacheline(sizeof *non_pmd);
     dp_netdev_configure_pmd(non_pmd, dp, NON_PMD_CORE_ID, OVS_NUMA_UNSPEC);
 }
 
@@ -6830,7 +6830,7 @@ dp_netdev_destroy_pmd(struct dp_netdev_pmd_thread *pmd)
     seq_destroy(pmd->reload_seq);
     ovs_mutex_destroy(&pmd->port_mutex);
     ovs_mutex_destroy(&pmd->bond_mutex);
-    free(pmd);
+    free_cacheline(pmd);
 }
 
 /* Stops the pmd thread, removes it from the 'dp->poll_threads',

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to