From patchwork Mon Apr 4 14:36:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 64999 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1223894lbc; Mon, 4 Apr 2016 07:37:01 -0700 (PDT) X-Received: by 10.55.78.201 with SMTP id c192mr34909842qkb.9.1459780621200; Mon, 04 Apr 2016 07:37:01 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 39si22434917qgn.107.2016.04.04.07.37.00; Mon, 04 Apr 2016 07:37:01 -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 CED1F617EE; Mon, 4 Apr 2016 14:37:00 +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_H2, 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 1346561673; Mon, 4 Apr 2016 14:36:53 +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 EE885616AD; Mon, 4 Apr 2016 14:36:50 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by lists.linaro.org (Postfix) with ESMTPS id D718461586 for ; Mon, 4 Apr 2016 14:36:48 +0000 (UTC) Received: by mail-oi0-f43.google.com with SMTP id y204so53038050oie.3 for ; Mon, 04 Apr 2016 07:36:48 -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=gRopU1KxflJO9tyvjTy81rOBHCmvKjKFpxWaikJ3qLA=; b=JOmaE1a0CW5QXwv8LFBV0HYHO8raXg9fWz0AhXFan6VY1m1PIYmX7yKZwXVPvhEalw pUhEq2H4RX8urwepYohC1smMn6ipu2pmoeF3vG6gZfkrT40dd01EXaFltpHq1v2WQCP3 PEDksQ1Rty6hr8Wi4aVvh2Tj3GMGWTaMVgj+wnM98WrfTfMnMeDCbS7tzmB2zzYIKDea uVNGV6safYNnJkfZI5HFNsNIpTXUjcq23rD00kNHKnJ1SFqgOYLZ24033A0Fo2+aQZZk 8kXk0/mnSukT8d6ujqtx5TdP/qT2K3Of6iwD1sW/urFKy3P5WsmZ+aLsAPfbImIKUwX8 oH2w== X-Gm-Message-State: AD7BkJJit0K+x3PoGFJPmIJXFbTNQxvyRJBu1Wzsvg7mNSLhMgFLEH5djovhSTbMSOKXg8efYqY= X-Received: by 10.157.40.22 with SMTP id m22mr2375201otb.30.1459780608396; Mon, 04 Apr 2016 07:36:48 -0700 (PDT) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id xm14sm8467600oeb.17.2016.04.04.07.36.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 07:36:47 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Mon, 4 Apr 2016 09:36:46 -0500 Message-Id: <1459780606-6588-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.5.0 X-Topics: patch Subject: [lng-odp] [PATCHv3] linux-generic: pktio: avoid coverity issues by adding explicit rc check 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" Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2138 by adding an explicit rc check for odp_pktio_capability(). Signed-off-by: Bill Fischofer --- platform/linux-generic/odp_packet_io.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 9192be2..2fe2cf3 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -1027,6 +1027,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, odp_pktio_capability_t capa; unsigned num_queues; unsigned i; + int rc; odp_queue_t queue; odp_pktin_queue_param_t default_param; @@ -1059,9 +1060,9 @@ int odp_pktin_queue_config(odp_pktio_t pktio, return -1; } - odp_pktio_capability(pktio, &capa); + rc = odp_pktio_capability(pktio, &capa); - if (num_queues > capa.max_input_queues) { + if (rc != 0 || num_queues > capa.max_input_queues) { ODP_DBG("pktio %s: too many input queues\n", entry->s.name); return -1; } @@ -1135,6 +1136,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, odp_pktio_capability_t capa; unsigned num_queues; unsigned i; + int rc; odp_pktout_queue_param_t default_param; if (param == NULL) { @@ -1172,9 +1174,9 @@ int odp_pktout_queue_config(odp_pktio_t pktio, return -1; } - odp_pktio_capability(pktio, &capa); + rc = odp_pktio_capability(pktio, &capa); - if (num_queues > capa.max_output_queues) { + if (rc != 0 || num_queues > capa.max_output_queues) { ODP_DBG("pktio %s: too many output queues\n", entry->s.name); return -1; }