From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by dpdk.org (Postfix) with ESMTP id 3B3AC4A63 for ; Tue, 8 Dec 2015 17:51:03 +0100 (CET) Received: by pfu207 with SMTP id 207so14699447pfu.2 for ; Tue, 08 Dec 2015 08:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8CVWniw2ZN3dkEwv5n5oiCiUqtnS3/xnbXL52SHfWNg=; b=X4iSC1aFLnkpD8EzHLAWZCDNtxPRCUUtYdVjvtJVoKv7WyuHCJQkA5MXAUYqYTDAD6 WzzKVlBu5PouYNPfnTgCR9LZG5QUgCIacxWUfoR1x74rjGnc/uynCfkeqz0uw9ElBmTp HtaUCHNnZbLY/b+w5UmPR+xNiUqO+Q5684+3HO5N6s1eCDdUGBA6Fv/Mhqs++qf51Fcs xnrmDVaXUtQ9L1F1Pe+10XQfQlYFfZtIhQ4VMDsCjZ2LIJ907H72RdstBmMcQbJ4jzvv eAZmp+VQgZsSZj9Foiv2mwJYOSnMgV6j2mrQqbYioHnfponRy3y0ZYVJJZtQbDyDXL59 9zwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8CVWniw2ZN3dkEwv5n5oiCiUqtnS3/xnbXL52SHfWNg=; b=fDHL0JcChzNpZlqZWAbfPvomgsE3t3SZ0bhrvf2EiPYA4SNXsG+VzyOcZiTtjqePX7 kBqsSy3TwcPLoiq5rL4XXATZxC9X+Bk59ov55fd5XomyF7/fTxNAlP8jVOkaCe1oNJH1 W+hNLy2w/ztkNuHzr30uG0h5J4GG40O0ntoyhhnyR0YyhCKzU56p8eUHoKMhJe6ZcNSY sSKuXtIIcBkxW8c/J0p8P1G0B+niBK4gn8MxqRPDeYUJqjSzdyiNmAz2OtKHzqAGn+gR vnmkd7a4efG5tPN0UCJ18JeaHuntFpFp7d1Af0WZ7ctrjhYCGWrfOzY6pCFCUQCaqk0H RDlA== X-Gm-Message-State: ALoCoQkuFiuUCYkDRr3NDJBoZy5C5snyi2YxexgHRq5/Rxx0edrMZ0jlsAP7i2dtyta4DSa7aGByisHvbvSXmvz5pW+1+qdqDQ== X-Received: by 10.98.7.193 with SMTP id 62mr6361004pfh.22.1449593462635; Tue, 08 Dec 2015 08:51:02 -0800 (PST) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id rz10sm5987206pac.29.2015.12.08.08.51.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 08:51:02 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Tue, 8 Dec 2015 08:51:08 -0800 Message-Id: <1449593469-16954-2-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449593469-16954-1-git-send-email-stephen@networkplumber.org> References: <1449593469-16954-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 1/2] ip_pipeline: fix coverity warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 16:51:03 -0000 Fix problem reported by latest Coverity scan. It won't have a direct impact on anything. Signed-off-by: Stephen Hemminger ** CID 120412: Code maintainability issues (SIZEOF_MISMATCH) /examples/ip_pipeline/thread_fe.c: 338 in app_pipeline_thread_cmd_push() *** CID 120412: Code maintainability issues (SIZEOF_MISMATCH) /examples/ip_pipeline/thread_fe.c: 338 in app_pipeline_thread_cmd_push() 332 /* Check for available slots in the application commands array */ 333 n_cmds = RTE_DIM(thread_cmds) - 1; 334 if (n_cmds > APP_MAX_CMDS - app->n_cmds) 335 return -ENOMEM; 336 337 /* Push thread commands into the application */ >>> CID 120412: Code maintainability issues (SIZEOF_MISMATCH) >>> Passing argument "&app->cmds[app->n_cmds]" of type "cmdline_parse_ctx_t *" and argument "n_cmds * 8UL /* sizeof (cmdline_parse_ctx_t *) */" to function "memcpy" is suspicious. In this case, "sizeof (cmdline_parse_ctx_t *)" is equal to "sizeof (cmdline_parse_ctx_t)", but this is not a portable assumption. 338 memcpy(&app->cmds[app->n_cmds], 339 thread_cmds, 340 n_cmds * sizeof(cmdline_parse_ctx_t *)); 341 342 for (i = 0; i < n_cmds; i++) 343 app->cmds[app->n_cmds + i]->data = app; --- examples/ip_pipeline/thread_fe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/ip_pipeline/thread_fe.c b/examples/ip_pipeline/thread_fe.c index 7a3bbf8..95f0107 100644 --- a/examples/ip_pipeline/thread_fe.c +++ b/examples/ip_pipeline/thread_fe.c @@ -335,9 +335,8 @@ app_pipeline_thread_cmd_push(struct app_params *app) return -ENOMEM; /* Push thread commands into the application */ - memcpy(&app->cmds[app->n_cmds], - thread_cmds, - n_cmds * sizeof(cmdline_parse_ctx_t *)); + memcpy(&app->cmds[app->n_cmds], thread_cmds, + n_cmds * sizeof(cmdline_parse_ctx_t)); for (i = 0; i < n_cmds; i++) app->cmds[app->n_cmds + i]->data = app; -- 2.1.4