diff mbox series

[ovs-dev] dpif-netdev/mfex avx512: fix ubsan shift on bitmask

Message ID 20220419163700.1465871-1-harry.van.haaren@intel.com
State Superseded
Headers show
Series [ovs-dev] dpif-netdev/mfex avx512: fix ubsan shift on bitmask | expand

Checks

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

Commit Message

Van Haaren, Harry April 19, 2022, 4:37 p.m. UTC
This commit ensures the compiler knows the 1 bit is an unsigned 32-bit
wide 1 bit, keeping undefined sanitizer happy at runtime.

Fixes: 250ceddcc ("dpif-netdev/mfex: Add AVX512 based optimized miniflow extract")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

 lib/dpif-netdev-extract-avx512.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eelco Chaudron April 20, 2022, 8:19 a.m. UTC | #1
On 19 Apr 2022, at 18:37, Harry van Haaren wrote:

> This commit ensures the compiler knows the 1 bit is an unsigned 32-bit
> wide 1 bit, keeping undefined sanitizer happy at runtime.

Same as other patch:

Change looks good to me, but should 1UL not be enough, as the destinations are all 32-bit?


> Fixes: 250ceddcc ("dpif-netdev/mfex: Add AVX512 based optimized miniflow extract")
>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
>
> ---
>
>  lib/dpif-netdev-extract-avx512.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/dpif-netdev-extract-avx512.c b/lib/dpif-netdev-extract-avx512.c
> index c1c1fefb6..8cd8b6c6e 100644
> --- a/lib/dpif-netdev-extract-avx512.c
> +++ b/lib/dpif-netdev-extract-avx512.c
> @@ -619,7 +619,7 @@ mfex_avx512_process(struct dp_packet_batch *packets,
>          };
>
>          /* This packet has its miniflow created, add to hitmask. */
> -        hitmask |= 1 << i;
> +        hitmask |= 1ULL << i;
>      }
>
>      return hitmask;
> -- 
> 2.25.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/lib/dpif-netdev-extract-avx512.c b/lib/dpif-netdev-extract-avx512.c
index c1c1fefb6..8cd8b6c6e 100644
--- a/lib/dpif-netdev-extract-avx512.c
+++ b/lib/dpif-netdev-extract-avx512.c
@@ -619,7 +619,7 @@  mfex_avx512_process(struct dp_packet_batch *packets,
         };
 
         /* This packet has its miniflow created, add to hitmask. */
-        hitmask |= 1 << i;
+        hitmask |= 1ULL << i;
     }
 
     return hitmask;