From 467eda64a93c9de001500ba7a90edb231eafad48 Mon Sep 17 00:00:00 2001 From: Andreas Nordal Date: Tue, 28 May 2024 23:54:55 +0200 Subject: [PATCH] FreeRTOS_DHCP_utest: Fix it for Gcc 11 Symptom: The call to FreeRTOS_recvfrom_ExpectAndReturn() clearly specifies that FreeRTOS_recvfrom() shall return the (NULL, 0) slice. But instead, it returns a random pointer and a lenght of 1. This happens only with Gcc 11 with AddressSanitizer, but no other compiler does that with or without AddressSanitizer. A random hunch: All other calls to FreeRTOS_recvfrom_ExpectAndReturn() set cmock_to_return=0 instead of 1. Last ditch attempt before ditching Gcc 11: I don't know what cmock_to_return is, but doing the same fixes the last AddressSanitizer error under Gcc 11 run by CI, and of course also works for all other builds I'm testing with. --- test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c b/test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c index a31b9b651..6d4211679 100644 --- a/test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c +++ b/test/unit-test/FreeRTOS_DHCP/FreeRTOS_DHCP_utest.c @@ -1586,7 +1586,7 @@ void test_vDHCPProcessEndPoint_eWaitingOfferNullUDPBuffer( void ) pxNetworkEndPoints = pxEndPoint; - FreeRTOS_recvfrom_ExpectAndReturn( xDHCPv4Socket, NULL, 0UL, FREERTOS_ZERO_COPY, NULL, NULL, 1 ); + FreeRTOS_recvfrom_ExpectAndReturn( xDHCPv4Socket, NULL, 0UL, FREERTOS_ZERO_COPY, NULL, NULL, 0 ); /* Ignore the buffer argument though. */ FreeRTOS_recvfrom_IgnoreArg_pvBuffer();