From patchwork Mon Apr 4 09:29:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 64962 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1056950lbc; Mon, 4 Apr 2016 01:29:56 -0700 (PDT) X-Received: by 10.140.99.5 with SMTP id p5mr4463364qge.16.1459758595959; Mon, 04 Apr 2016 01:29:55 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f7si21466042qhd.114.2016.04.04.01.29.55; Mon, 04 Apr 2016 01:29:55 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 46FC76166D; Mon, 4 Apr 2016 08:29:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9825F61624; Mon, 4 Apr 2016 08:29:51 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 082AA61642; Mon, 4 Apr 2016 08:29:48 +0000 (UTC) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by lists.linaro.org (Postfix) with ESMTPS id 0790661622 for ; Mon, 4 Apr 2016 08:29:46 +0000 (UTC) Received: by mail-lb0-f177.google.com with SMTP id u8so149245762lbk.0 for ; Mon, 04 Apr 2016 01:29:45 -0700 (PDT) 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; bh=V3Ib5SPaQUwi4b/uESx/8KCA5qpVrXsAw2OrDI9wNsQ=; b=Ri1iRpx9xxx5+Z5xtzKaj++E6Z9oydccRHqqVBLOzHBWTX68zO3TR/UTk54x8vabKz zmqw8rlJO/IYrBiymP0FshEjWhur8e0AJW3DDbDbLHTfDHMcft+A+PBeC4lZLKu6cYyy TLZOAD67zBJrYi3CBjc8u2sQKh78H9u33HeRxhWUPHfjvnyK0Y1udzSRy9E2ADMDrbFG Q/TKFGUEs+7hY1DZJbeCtNZauP9ml4DhOyQikcSt9Y32U4UDlTGC/hBmGwurUp6gqXSr w03X1eD2RbSWOblayPnTuAveBDB0JsYopwL92m1SDfxgKtCtERolp5lcS/B3bSaAu/IA GyxA== X-Gm-Message-State: AD7BkJIQtVc2v3j61ENi2EKHfpplh320xY6jTBe5SvnpdQdHwAv+usSKyOS+bF/Hra+5b9QUbgg= X-Received: by 10.112.167.37 with SMTP id zl5mr65107lbb.60.1459758583939; Mon, 04 Apr 2016 01:29:43 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id zi6sm4545698lbb.5.2016.04.04.01.29.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 01:29:43 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, bill.fischofer@linaro.org Date: Mon, 4 Apr 2016 11:29:05 +0200 Message-Id: <1459762145-40697-1-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH] linux-generic: test: shmem: coverity fix X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Fixes: https://bugs.linaro.org/show_bug.cgi?id=2148 (CID 159393) The if statement introduced here is redundant with the previous CU_ASSERT_FATAL, but avoids the coverity warning. (coverity probably misses the longjump in CU_ASSERT_FATAL) Signed-off-by: Christophe Milard Reviewed-by: Bill Fischofer --- NOTE: to be applied on to of: "linux-generic: test: shmem: close fifo" platform/linux-generic/test/shmem/shmem_odp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/test/shmem/shmem_odp.c b/platform/linux-generic/test/shmem/shmem_odp.c index a1f750f..77c5a01 100644 --- a/platform/linux-generic/test/shmem/shmem_odp.c +++ b/platform/linux-generic/test/shmem/shmem_odp.c @@ -47,9 +47,11 @@ void shmem_test_odp_shm_proc(void) fd = open(fifo_name, O_RDONLY); CU_ASSERT_FATAL(fd >= 0); - CU_ASSERT(read(fd, &test_result, sizeof(char)) == 1); - close(fd); - CU_ASSERT_FATAL(test_result == TEST_SUCCESS); + if (fd >= 0) { /* redundant, but to avoid coverity CID 159393 */ + CU_ASSERT_FATAL(read(fd, &test_result, sizeof(char)) == 1); + close(fd); + CU_ASSERT_FATAL(test_result == TEST_SUCCESS); + } CU_ASSERT(odp_shm_free(shm) == 0); }