diff mbox series

[ovs-dev,6/6] pinctrl: Avoid misaligned access to ovs_ra_msg.

Message ID 20211217212948.5491.76660.stgit@dceara.remote.csb
State Accepted
Headers show
Series Fix UndefinedBehaviorSanitizer reported issues. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Dumitru Ceara Dec. 17, 2021, 9:29 p.m. UTC
UB Sanitizer report:
  controller/pinctrl.c:6013:27: runtime error: member access within misaligned address 0x000002028836 for type 'struct ovs_ra_msg', which requires 4 byte alignment
  0x000002028836: note: pointer points here
   00 00 00 02 86 00  00 00 ff 00 ff ff 00 00  00 00 00 00 00 00 01 01  fa 16 3e 00 00 01 03 04  40 c0
               ^
      #0 0x47fb65 in pinctrl_handle_put_nd_ra_opts controller/pinctrl.c:6013
      #1 0x46e0f1 in process_packet_in controller/pinctrl.c:3165
      [...]

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
---
 controller/pinctrl.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Numan Siddique Dec. 21, 2021, 5:29 p.m. UTC | #1
On Fri, Dec 17, 2021 at 4:30 PM Dumitru Ceara <dceara@redhat.com> wrote:
>
> UB Sanitizer report:
>   controller/pinctrl.c:6013:27: runtime error: member access within misaligned address 0x000002028836 for type 'struct ovs_ra_msg', which requires 4 byte alignment
>   0x000002028836: note: pointer points here
>    00 00 00 02 86 00  00 00 ff 00 ff ff 00 00  00 00 00 00 00 00 01 01  fa 16 3e 00 00 01 03 04  40 c0
>                ^
>       #0 0x47fb65 in pinctrl_handle_put_nd_ra_opts controller/pinctrl.c:6013
>       #1 0x46e0f1 in process_packet_in controller/pinctrl.c:3165
>       [...]
>
> Signed-off-by: Dumitru Ceara <dceara@redhat.com>


Acked-by: Numan Siddique <numans@ovn.org>

Numan

> ---
>  controller/pinctrl.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/controller/pinctrl.c b/controller/pinctrl.c
> index 87e1cc2d0..d2bb7f441 100644
> --- a/controller/pinctrl.c
> +++ b/controller/pinctrl.c
> @@ -5991,6 +5991,8 @@ pinctrl_handle_put_nd_ra_opts(
>      struct dp_packet pkt_out;
>      dp_packet_init(&pkt_out, new_packet_size);
>      dp_packet_clear(&pkt_out);
> +    /* Properly align after the ethernet header */
> +    dp_packet_reserve(&pkt_out, 2);
>      dp_packet_prealloc_tailroom(&pkt_out, new_packet_size);
>      pkt_out_ptr = &pkt_out;
>
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/controller/pinctrl.c b/controller/pinctrl.c
index 87e1cc2d0..d2bb7f441 100644
--- a/controller/pinctrl.c
+++ b/controller/pinctrl.c
@@ -5991,6 +5991,8 @@  pinctrl_handle_put_nd_ra_opts(
     struct dp_packet pkt_out;
     dp_packet_init(&pkt_out, new_packet_size);
     dp_packet_clear(&pkt_out);
+    /* Properly align after the ethernet header */
+    dp_packet_reserve(&pkt_out, 2);
     dp_packet_prealloc_tailroom(&pkt_out, new_packet_size);
     pkt_out_ptr = &pkt_out;