diff mbox series

[ovs-dev,v2,3/7] netdev-afxdp: Hide too large memset from sparse.

Message ID 20221219122020.3778161-4-i.maximets@ovn.org
State Superseded
Headers show
Series AF_XDP build fixes and enhancements. | expand

Checks

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

Commit Message

Ilya Maximets Dec. 19, 2022, 12:20 p.m. UTC
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.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 .ci/linux-build.sh | 4 ----
 lib/netdev-afxdp.c | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Eelco Chaudron Dec. 20, 2022, 1:02 p.m. UTC | #1
On 19 Dec 2022, at 13:20, Ilya Maximets wrote:

> 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.
>
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

Looks good to me.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
diff mbox series

Patch

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 1f8896423..6d2b90ccf 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -247,10 +247,6 @@  elif [ "$M32" ]; then
     export CC="$CC -m32"
 elif [ "$TRAVIS_ARCH" != "aarch64" ]; then
     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 6ced8a2b6..cbb9046db 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);