On 5/25/21 9:44 AM, Peter Maydell wrote:
> 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>
> ---
> tests/qtest/e1000e-test.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c
> index fc226fdfeb5..0273fe4c156 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 */