diff mbox series

[ovs-dev,v3,1/3] netdev-dummy: Allocate dummy_packet_stream on cacheline boundary

Message ID 20230130160315.492318-1-mkp@redhat.com
State Changes Requested
Headers show
Series [ovs-dev,v3,1/3] netdev-dummy: Allocate dummy_packet_stream on cacheline boundary | expand

Commit Message

Mike Pattrick Jan. 30, 2023, 4:03 p.m. UTC
UB Sanitizer report:

lib/netdev-dummy.c:197:15: runtime error: member access within
misaligned address 0x00000217a7f0 for type 'struct
dummy_packet_stream', which requires 64 byte alignment
              ^
    #0 dummy_packet_stream_init lib/netdev-dummy.c:197
    #1 dummy_packet_stream_create lib/netdev-dummy.c:208
    #2 dummy_packet_conn_set_config lib/netdev-dummy.c:436
    [...]

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

---

v3:
 - used proper free method for non-posix platforms
---
 lib/netdev-dummy.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Ilya Maximets Jan. 30, 2023, 7:03 p.m. UTC | #1
On 1/30/23 17:03, Mike Pattrick wrote:
> UB Sanitizer report:
> 
> lib/netdev-dummy.c:197:15: runtime error: member access within
> misaligned address 0x00000217a7f0 for type 'struct
> dummy_packet_stream', which requires 64 byte alignment
>               ^
>     #0 dummy_packet_stream_init lib/netdev-dummy.c:197
>     #1 dummy_packet_stream_create lib/netdev-dummy.c:208
>     #2 dummy_packet_conn_set_config lib/netdev-dummy.c:436
>     [...]
> 
> Signed-off-by: Mike Pattrick <mkp@redhat.com>
> 
> ---
> 
> v3:
>  - used proper free method for non-posix platforms
> ---
>  lib/netdev-dummy.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Hi, Mike.

You sent this series as two separate submissions both of which are 'incomplete'
from the patchwork's point of view.  Hence, CI is not triggered on them.

Could you, please, re-send the series, so it will get tested?
Thanks.

Best regards, Ilya Maximets.
Mike Pattrick Jan. 30, 2023, 7:23 p.m. UTC | #2
On Mon, Jan 30, 2023 at 2:03 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> On 1/30/23 17:03, Mike Pattrick wrote:
> > UB Sanitizer report:
> >
> > lib/netdev-dummy.c:197:15: runtime error: member access within
> > misaligned address 0x00000217a7f0 for type 'struct
> > dummy_packet_stream', which requires 64 byte alignment
> >               ^
> >     #0 dummy_packet_stream_init lib/netdev-dummy.c:197
> >     #1 dummy_packet_stream_create lib/netdev-dummy.c:208
> >     #2 dummy_packet_conn_set_config lib/netdev-dummy.c:436
> >     [...]
> >
> > Signed-off-by: Mike Pattrick <mkp@redhat.com>
> >
> > ---
> >
> > v3:
> >  - used proper free method for non-posix platforms
> > ---
> >  lib/netdev-dummy.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
>
> Hi, Mike.
>
> You sent this series as two separate submissions both of which are 'incomplete'
> from the patchwork's point of view.  Hence, CI is not triggered on them.
>

Doh! I'll resend.

-M

> Could you, please, re-send the series, so it will get tested?
> Thanks.
>
> Best regards, Ilya Maximets.
>
diff mbox series

Patch

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 72cb95471..921e5d533 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -204,7 +204,7 @@  dummy_packet_stream_create(struct stream *stream)
 {
     struct dummy_packet_stream *s;
 
-    s = xzalloc(sizeof *s);
+    s = xzalloc_cacheline(sizeof *s);
     dummy_packet_stream_init(s, stream);
 
     return s;
@@ -350,7 +350,7 @@  dummy_packet_conn_close(struct dummy_packet_conn *conn)
         pstream_close(pconn->pstream);
         for (i = 0; i < pconn->n_streams; i++) {
             dummy_packet_stream_close(pconn->streams[i]);
-            free(pconn->streams[i]);
+            free_cachelines(pconn->streams[i]);
         }
         free(pconn->streams);
         pconn->pstream = NULL;
@@ -359,7 +359,7 @@  dummy_packet_conn_close(struct dummy_packet_conn *conn)
 
     case ACTIVE:
         dummy_packet_stream_close(rconn->rstream);
-        free(rconn->rstream);
+        free_cacheline(rconn->rstream);
         rconn->rstream = NULL;
         reconnect_destroy(rconn->reconnect);
         rconn->reconnect = NULL;
@@ -469,7 +469,7 @@  dummy_pconn_run(struct netdev_dummy *dev)
         pconn->streams = xrealloc(pconn->streams,
                                 ((pconn->n_streams + 1)
                                  * sizeof s));
-        s = xmalloc(sizeof *s);
+        s = xmalloc_cacheline(sizeof *s);
         pconn->streams[pconn->n_streams++] = s;
         dummy_packet_stream_init(s, new_stream);
     } else if (error != EAGAIN) {
@@ -489,7 +489,7 @@  dummy_pconn_run(struct netdev_dummy *dev)
                      stream_get_name(s->stream),
                      ovs_retval_to_string(error));
             dummy_packet_stream_close(s);
-            free(s);
+            free_cacheline(s);
             pconn->streams[i] = pconn->streams[--pconn->n_streams];
         } else {
             i++;