diff mbox

validation: pktio check for number of interfaces

Message ID 1454912425-14888-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit df85537f7c57cb2e39f865b5c0081bfac8697253
Headers show

Commit Message

Maxim Uvarov Feb. 8, 2016, 6:20 a.m. UTC
CI got following error:
pktio.c: In function 'pktio_test_recv_queue':
pktio.c:643:11: error: 'pktio[0]' may be used uninitialized
	in this function [-Werror=maybe-uninitialized]
  pktio_tx = pktio[0]

That can never happen due to num_ifaces always > 1 in our test.
Add special check for that to make new gcc happy.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 I can not reproduce that warning. But this patch should to remove it.

 Maxim.


 test/validation/pktio/pktio.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Maxim Uvarov Feb. 8, 2016, 6:21 a.m. UTC | #1
That is for api-next.

Maxim.

On 02/08/2016 09:20, Maxim Uvarov wrote:
> CI got following error:
> pktio.c: In function 'pktio_test_recv_queue':
> pktio.c:643:11: error: 'pktio[0]' may be used uninitialized
> 	in this function [-Werror=maybe-uninitialized]
>    pktio_tx = pktio[0]
>
> That can never happen due to num_ifaces always > 1 in our test.
> Add special check for that to make new gcc happy.
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>   I can not reproduce that warning. But this patch should to remove it.
>
>   Maxim.
>
>
>   test/validation/pktio/pktio.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
> index 980b092..f3577ec 100644
> --- a/test/validation/pktio/pktio.c
> +++ b/test/validation/pktio/pktio.c
> @@ -611,6 +611,8 @@ void pktio_test_recv_queue(void)
>   	int ret;
>   	int i;
>
> +	CU_ASSERT_FATAL(num_ifaces >= 1);
> +
>   	/* Open and configure interfaces */
>   	for (i = 0; i < num_ifaces; ++i) {
>   		pktio[i] = create_pktio(i, ODP_PKTIN_MODE_DIRECT,
Maxim Uvarov Feb. 8, 2016, 12:35 p.m. UTC | #2
Merged,
Maxim.


On 02/08/2016 16:28, Christophe Milard wrote:
> On 2016-02-08 09:20, Maxim Uvarov wrote:
>> CI got following error:
>> pktio.c: In function 'pktio_test_recv_queue':
>> pktio.c:643:11: error: 'pktio[0]' may be used uninitialized
>> 	in this function [-Werror=maybe-uninitialized]
>>    pktio_tx = pktio[0]
>>
>> That can never happen due to num_ifaces always > 1 in our test.
>> Add special check for that to make new gcc happy.
>>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> For api-next:
> Reviewed-by: Christophe Milard <christophe.milard@linaro.org>
>
>> ---
>>   I can not reproduce that warning. But this patch should to remove it.
>>
>>   Maxim.
>>
>>
>>   test/validation/pktio/pktio.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
>> index 980b092..f3577ec 100644
>> --- a/test/validation/pktio/pktio.c
>> +++ b/test/validation/pktio/pktio.c
>> @@ -611,6 +611,8 @@ void pktio_test_recv_queue(void)
>>   	int ret;
>>   	int i;
>>   
>> +	CU_ASSERT_FATAL(num_ifaces >= 1);
>> +
>>   	/* Open and configure interfaces */
>>   	for (i = 0; i < num_ifaces; ++i) {
>>   		pktio[i] = create_pktio(i, ODP_PKTIN_MODE_DIRECT,
>> -- 
>> 1.9.1
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
Christophe Milard Feb. 8, 2016, 1:28 p.m. UTC | #3
On 2016-02-08 09:20, Maxim Uvarov wrote:
> CI got following error:
> pktio.c: In function 'pktio_test_recv_queue':
> pktio.c:643:11: error: 'pktio[0]' may be used uninitialized
> 	in this function [-Werror=maybe-uninitialized]
>   pktio_tx = pktio[0]
> 
> That can never happen due to num_ifaces always > 1 in our test.
> Add special check for that to make new gcc happy.
> 
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
For api-next:
Reviewed-by: Christophe Milard <christophe.milard@linaro.org>

> ---
>  I can not reproduce that warning. But this patch should to remove it.
> 
>  Maxim.
> 
> 
>  test/validation/pktio/pktio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
> index 980b092..f3577ec 100644
> --- a/test/validation/pktio/pktio.c
> +++ b/test/validation/pktio/pktio.c
> @@ -611,6 +611,8 @@ void pktio_test_recv_queue(void)
>  	int ret;
>  	int i;
>  
> +	CU_ASSERT_FATAL(num_ifaces >= 1);
> +
>  	/* Open and configure interfaces */
>  	for (i = 0; i < num_ifaces; ++i) {
>  		pktio[i] = create_pktio(i, ODP_PKTIN_MODE_DIRECT,
> -- 
> 1.9.1
> 
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 980b092..f3577ec 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -611,6 +611,8 @@  void pktio_test_recv_queue(void)
 	int ret;
 	int i;
 
+	CU_ASSERT_FATAL(num_ifaces >= 1);
+
 	/* Open and configure interfaces */
 	for (i = 0; i < num_ifaces; ++i) {
 		pktio[i] = create_pktio(i, ODP_PKTIN_MODE_DIRECT,