mirror of https://gitee.com/openkylin/qemu.git
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
This commit is contained in:
parent
3c65e439b2
commit
380822edb3
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue