From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 650A9A0350 for ; Mon, 21 Feb 2022 16:39:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FD064013F; Mon, 21 Feb 2022 16:39:19 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 608AA410E0 for ; Mon, 21 Feb 2022 16:39:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645457956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1hAMOgUSqrbqbnQTkeoqdR7N+bFkFqaSIv7b3sMr7KY=; b=fFDIAXGLi9yN+LMIbLCaBsUjf/qWwdLxDdhXVQB80R6Cp9iRCozsQgtPYibvDJ5bCebPv6 PFpPARmKA93XcpQIvPAiXfcpr8nD5I0/z1DFi+Yf5vMusZmLWiiPzr6NNLJ3Nz+HRhI83g NV8YYp2V7oD8YRfWGCjjzvsaft8pb8w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-351-_SUL6qfYNJ6jogQ1u0H-rw-1; Mon, 21 Feb 2022 10:39:13 -0500 X-MC-Unique: _SUL6qfYNJ6jogQ1u0H-rw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 942C115720; Mon, 21 Feb 2022 15:39:12 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2490278DDE; Mon, 21 Feb 2022 15:39:10 +0000 (UTC) From: Kevin Traynor To: Maxime Gouin Cc: Olivier Matz , Kevin Traynor , Ferruh Yigit , dpdk stable Subject: patch 'net/nfp: remove useless range checks' has been queued to stable release 21.11.1 Date: Mon, 21 Feb 2022 15:34:30 +0000 Message-Id: <20220221153625.152324-81-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/26/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/41569f9debc999abc530b92542ca829b27fb8c8e Thanks. Kevin --- >From 41569f9debc999abc530b92542ca829b27fb8c8e Mon Sep 17 00:00:00 2001 From: Maxime Gouin Date: Wed, 5 Jan 2022 11:32:03 +0100 Subject: [PATCH] net/nfp: remove useless range checks [ upstream commit a52c79642ab4296763189dd8efadbb679d32c9a0 ] Reported by code analysis tool C++test (version 10.4): > /build/dpdk-20.11/drivers/net/nfp/nfpcore/nfp_target.h > 375 Condition "island < 1" is always evaluated to false > 415 Condition "island < 1" is always evaluated to false > 547 Condition "target < 0" is always evaluated to false All of these conditions have the same error. They call NFP_CPP_ID_ISLAND_of or NFP_CPP_ID_TARGET_of which return a uint8_t and put the result in "island" or "target" which are integers. These variables can only contain values between 0 and 255. Fixes: c7e9729da6b5 ("net/nfp: support CPP") Signed-off-by: Maxime Gouin Reviewed-by: Olivier Matz Acked-by: Kevin Traynor Reviewed-by: Ferruh Yigit --- drivers/net/nfp/nfpcore/nfp_target.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp_target.h b/drivers/net/nfp/nfpcore/nfp_target.h index 2884a0034f..e8dcc9ad1e 100644 --- a/drivers/net/nfp/nfpcore/nfp_target.h +++ b/drivers/net/nfp/nfpcore/nfp_target.h @@ -38,5 +38,5 @@ static inline int target_rw(uint32_t cpp_id, int pp, int start, int len) { - int island = NFP_CPP_ID_ISLAND_of(cpp_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_id); if (island && (island < start || island > (start + len))) @@ -118,5 +118,5 @@ static inline int nfp6000_nbi(uint32_t cpp_id, uint64_t address) { - int island = NFP_CPP_ID_ISLAND_of(cpp_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_id); uint64_t rel_addr = address & 0x3fFFFF; @@ -282,5 +282,5 @@ nfp6000_mu(uint32_t cpp_id, uint64_t address) { int pp; - int island = NFP_CPP_ID_ISLAND_of(cpp_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_id); if (island == 0) { @@ -317,5 +317,5 @@ static inline int nfp6000_ila(uint32_t cpp_id) { - int island = NFP_CPP_ID_ISLAND_of(cpp_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_id); if (island && (island < 48 || island > 51)) @@ -337,5 +337,5 @@ static inline int nfp6000_pci(uint32_t cpp_id) { - int island = NFP_CPP_ID_ISLAND_of(cpp_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_id); if (island && (island < 4 || island > 7)) @@ -355,5 +355,5 @@ static inline int nfp6000_crypto(uint32_t cpp_id) { - int island = NFP_CPP_ID_ISLAND_of(cpp_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_id); if (island && (island < 12 || island > 15)) @@ -371,7 +371,7 @@ static inline int nfp6000_cap_xpb(uint32_t cpp_id) { - int island = NFP_CPP_ID_ISLAND_of(cpp_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_id); - if (island && (island < 1 || island > 63)) + if (island > 63) return NFP_ERRNO(EINVAL); @@ -411,7 +411,7 @@ static inline int nfp6000_cls(uint32_t cpp_id) { - int island = NFP_CPP_ID_ISLAND_of(cpp_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_id); - if (island && (island < 1 || island > 63)) + if (island > 63) return NFP_ERRNO(EINVAL); @@ -541,9 +541,9 @@ nfp_target_cpp(uint32_t cpp_island_id, uint64_t cpp_island_address, { int err; - int island = NFP_CPP_ID_ISLAND_of(cpp_island_id); - int target = NFP_CPP_ID_TARGET_of(cpp_island_id); + uint8_t island = NFP_CPP_ID_ISLAND_of(cpp_island_id); + uint8_t target = NFP_CPP_ID_TARGET_of(cpp_island_id); uint32_t imb; - if (target < 0 || target >= 16) + if (target >= 16) return NFP_ERRNO(EINVAL); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:46.397899397 +0000 +++ 0081-net-nfp-remove-useless-range-checks.patch 2022-02-21 15:22:44.172704308 +0000 @@ -1 +1 @@ -From a52c79642ab4296763189dd8efadbb679d32c9a0 Mon Sep 17 00:00:00 2001 +From 41569f9debc999abc530b92542ca829b27fb8c8e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit a52c79642ab4296763189dd8efadbb679d32c9a0 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org