From 98fb2bed6362a01b44e2b36cc49aa26eb96f3a41 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 10 Jul 2017 12:58:59 +0300 Subject: [PATCH] net: Comment false positives reported by Coverity Coverity reported false positives, add comment about these in the code. Jira: ZEP-2344 Jira: ZEP-2345 Signed-off-by: Jukka Rissanen --- subsys/net/lib/http/http_client.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/subsys/net/lib/http/http_client.c b/subsys/net/lib/http/http_client.c index a34223ef337..79a65c063ab 100644 --- a/subsys/net/lib/http/http_client.c +++ b/subsys/net/lib/http/http_client.c @@ -903,8 +903,18 @@ static int https_init(struct http_client_ctx *ctx) mbedtls_platform_set_printf(printk); + /* Coverity tells in CID 170746 that the mbedtls_ssl_init() + * is overwriting the ssl struct. This looks like false positive as + * the struct is initialized with proper size. + */ mbedtls_ssl_init(&ctx->https.mbedtls.ssl); + + /* Coverity tells in CID 170745 that the mbedtls_ssl_config_init() + * is overwriting the conf struct. This looks like false positive as + * the struct is initialized with proper size. + */ mbedtls_ssl_config_init(&ctx->https.mbedtls.conf); + mbedtls_entropy_init(&ctx->https.mbedtls.entropy); mbedtls_ctr_drbg_init(&ctx->https.mbedtls.ctr_drbg); @@ -1513,6 +1523,10 @@ int http_client_init(struct http_client_ctx *ctx, { int ret; + /* Coverity tells in CID 170743 that the next memset() is + * is overwriting the ctx struct. This is false positive as + * the struct is initialized with proper size. + */ memset(ctx, 0, sizeof(*ctx)); if (server) { @@ -1712,5 +1726,9 @@ void http_client_release(struct http_client_ctx *ctx) /* Let all the pending waiters run */ k_yield(); + /* Coverity tells in CID 170742 that the next memset() is + * is overwriting the ctx struct. This is false positive as + * the struct is initialized with proper size. + */ memset(ctx, 0, sizeof(*ctx)); }