diff mbox

example ipsec: init crypto result to 0

Message ID 1424887638-30040-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Feb. 25, 2015, 6:07 p.m. UTC
In bug:
https://bugs.linaro.org/show_bug.cgi?id=1186
Coverity warns:
CID 86888:  Uninitialized scalar variable  (UNINIT)
Declaring variable "result" without initializer.
In general result here is output and there is no need
to init it to 0.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 Note: I have no idea why Coverity warns about not init variable. But
 that patch have to made Coverity happy.

 example/ipsec/odp_ipsec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bill Fischofer Feb. 25, 2015, 6:10 p.m. UTC | #1
On Wed, Feb 25, 2015 at 12:07 PM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> In bug:
> https://bugs.linaro.org/show_bug.cgi?id=1186
> Coverity warns:
> CID 86888:  Uninitialized scalar variable  (UNINIT)
> Declaring variable "result" without initializer.
> In general result here is output and there is no need
> to init it to 0.
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>


> ---
>  Note: I have no idea why Coverity warns about not init variable. But
>  that patch have to made Coverity happy.
>
>  example/ipsec/odp_ipsec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index 1aa68db..999e2f4 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -1056,7 +1056,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED)
>                 pkt_disposition_e rc;
>                 pkt_ctx_t   *ctx;
>                 odp_queue_t  dispatchq;
> -               odp_crypto_op_result_t result;
> +               odp_crypto_op_result_t result = {0};
>
>                 /* Use schedule to get event from any input queue */
>                 ev = SCHEDULE(&dispatchq, ODP_SCHED_WAIT);
> --
> 1.8.5.1.163.gd7aced9
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes Feb. 25, 2015, 8:50 p.m. UTC | #2
On 25 February 2015 at 13:07, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> In bug:
> https://bugs.linaro.org/show_bug.cgi?id=1186
> Coverity warns:
> CID 86888:  Uninitialized scalar variable  (UNINIT)
> Declaring variable "result" without initializer.
> In general result here is output and there is no need
> to init it to 0.
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>  Note: I have no idea why Coverity warns about not init variable. But
>  that patch have to made Coverity happy.
>

We should not  fix something we don't understand, possibly the correct
action is to mark this as a false positive in coverty, but either way we
should be sure.


>
>  example/ipsec/odp_ipsec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index 1aa68db..999e2f4 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -1056,7 +1056,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED)
>                 pkt_disposition_e rc;
>                 pkt_ctx_t   *ctx;
>                 odp_queue_t  dispatchq;
> -               odp_crypto_op_result_t result;
> +               odp_crypto_op_result_t result = {0};
>
>                 /* Use schedule to get event from any input queue */
>                 ev = SCHEDULE(&dispatchq, ODP_SCHED_WAIT);
> --
> 1.8.5.1.163.gd7aced9
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Bill Fischofer Feb. 25, 2015, 8:56 p.m. UTC | #3
I agree this is one of many false positives, but we've been trying to
accommodate these checker tools when the cost isn't much.

On Wed, Feb 25, 2015 at 2:50 PM, Mike Holmes <mike.holmes@linaro.org> wrote:

>
>
> On 25 February 2015 at 13:07, Maxim Uvarov <maxim.uvarov@linaro.org>
> wrote:
>
>> In bug:
>> https://bugs.linaro.org/show_bug.cgi?id=1186
>> Coverity warns:
>> CID 86888:  Uninitialized scalar variable  (UNINIT)
>> Declaring variable "result" without initializer.
>> In general result here is output and there is no need
>> to init it to 0.
>>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>  Note: I have no idea why Coverity warns about not init variable. But
>>  that patch have to made Coverity happy.
>>
>
> We should not  fix something we don't understand, possibly the correct
> action is to mark this as a false positive in coverty, but either way we
> should be sure.
>
>
>>
>>  example/ipsec/odp_ipsec.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
>> index 1aa68db..999e2f4 100644
>> --- a/example/ipsec/odp_ipsec.c
>> +++ b/example/ipsec/odp_ipsec.c
>> @@ -1056,7 +1056,7 @@ void *pktio_thread(void *arg EXAMPLE_UNUSED)
>>                 pkt_disposition_e rc;
>>                 pkt_ctx_t   *ctx;
>>                 odp_queue_t  dispatchq;
>> -               odp_crypto_op_result_t result;
>> +               odp_crypto_op_result_t result = {0};
>>
>>                 /* Use schedule to get event from any input queue */
>>                 ev = SCHEDULE(&dispatchq, ODP_SCHED_WAIT);
>> --
>> 1.8.5.1.163.gd7aced9
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
>
> --
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
diff mbox

Patch

diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 1aa68db..999e2f4 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1056,7 +1056,7 @@  void *pktio_thread(void *arg EXAMPLE_UNUSED)
 		pkt_disposition_e rc;
 		pkt_ctx_t   *ctx;
 		odp_queue_t  dispatchq;
-		odp_crypto_op_result_t result;
+		odp_crypto_op_result_t result = {0};
 
 		/* Use schedule to get event from any input queue */
 		ev = SCHEDULE(&dispatchq, ODP_SCHED_WAIT);