aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-05-25 14:44:54 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-06-03 16:43:27 +0100
commit380822edb3252962001a47c02facb7c7e977dc7d (patch)
tree5bfcebd1bc927ea5ea54656209c0ec0402a3e7ad /tests
parent3c65e439b2724cc70af31a87447a0c7292babac5 (diff)
downloadqemu-380822edb3252962001a47c02facb7c7e977dc7d.zip
qemu-380822edb3252962001a47c02facb7c7e977dc7d.tar.gz
qemu-380822edb3252962001a47c02facb7c7e977dc7d.tar.bz2
tests/qtest/e1000e-test: Check qemu_recv() succeeded
The e1000e_send_verify() test calls qemu_recv() but doesn't check that the call succeeded, which annoys Coverity. Add an explicit test check for the length of the data. (This is a test check, not a "we assume this syscall always succeeds", so we use g_assert_cmpint() rather than g_assert().) Fixes: Coverity CID 1432324 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-id: 20210525134458.6675-3-peter.maydell@linaro.org
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/e1000e-test.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c
index fc226fd..0273fe4 100644
--- a/tests/qtest/e1000e-test.c
+++ b/tests/qtest/e1000e-test.c
@@ -93,7 +93,8 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
/* Check data sent to the backend */
ret = qemu_recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
g_assert_cmpint(ret, == , sizeof(recv_len));
- qemu_recv(test_sockets[0], buffer, 64, 0);
+ ret = qemu_recv(test_sockets[0], buffer, 64, 0);
+ g_assert_cmpint(ret, >=, 5);
g_assert_cmpstr(buffer, == , "TEST");
/* Free test data buffer */