Sparse complains about 64M umem initialization.  Hide it from
the checker instead of disabling a warning globally.

SPARSE_FLAGS are kept in the CI script even though they are
empty at the moment.

Acked-by: Eelco Chaudron <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
---
 .ci/linux-build.sh | 4 ----
 lib/netdev-afxdp.c | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index a944cf149..e6e4f6a60 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -222,10 +222,6 @@ elif [ "$M32" ]; then
     export CC="$CC -m32"
 else
     EXTRA_OPTS="$EXTRA_OPTS --enable-sparse"
-    if [ "$AFXDP" ]; then
-        # netdev-afxdp uses memset for 64M for umem initialization.
-        SPARSE_FLAGS="${SPARSE_FLAGS} -Wno-memcpy-max-count"
-    fi
     CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}"
 fi
 
diff --git a/lib/netdev-afxdp.c b/lib/netdev-afxdp.c
index f8995da1f..16f26bc30 100644
--- a/lib/netdev-afxdp.c
+++ b/lib/netdev-afxdp.c
@@ -434,7 +434,11 @@ xsk_configure(int ifindex, int xdp_queue_id, enum 
afxdp_mode mode,
 
     /* Umem memory region. */
     bufs = xmalloc_pagealign(NUM_FRAMES * FRAME_SIZE);
+#ifndef __CHECKER__
+    /* Sparse complains about a very large memset, but it is OK in this case.
+     * So, hiding it from the checker. */
     memset(bufs, 0, NUM_FRAMES * FRAME_SIZE);
+#endif
 
     /* Create AF_XDP socket. */
     umem = xsk_configure_umem(bufs, NUM_FRAMES * FRAME_SIZE);
-- 
2.38.1

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

Reply via email to