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 6B022A034C for ; Fri, 25 Feb 2022 18:16:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6286D41150; Fri, 25 Feb 2022 18:16:44 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id DF2FD410FD for ; Fri, 25 Feb 2022 18:16:43 +0100 (CET) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B018D3FCAD for ; Fri, 25 Feb 2022 17:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645809403; bh=DRnfTl6Kj0DJB7jUVUysOtBdLGtNbIOTdBSfG7nDaQw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EPQsq9Rkbm+CLZP9zNU0qUmLcx4YRBjU1m8rhLg0wbNiovxnfB3M2MkOqbLQ5oCWm 1PKigJKh+ZoU7JvfrBBCm5YdOEQh5sdnk/eE8iWxz9zZ1OMlXD7FKzou9zhpTTrJcR /ZyCCeBarOB5S2FLqOu5QpcX5p54gWUdRsKJ2A7HIyV4Fr9KVz1zMkpK0oJMFzBAaq nKLgzx+BfwbrPeYyExpD/xZsWs5vSjYqGUS413+1gTyppZ9IVvGRo3uDIUJsmC5oO6 i+k0I+ec2qYx4JAfGD9BAYsmsImoUctMhkMHSjM48FRsRNuGsM5Et8MTKkgXvUU5zR vhmNrIrbA+ocA== Received: by mail-wm1-f71.google.com with SMTP id c5-20020a1c3505000000b0034a0dfc86aaso1834258wma.6 for ; Fri, 25 Feb 2022 09:16:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DRnfTl6Kj0DJB7jUVUysOtBdLGtNbIOTdBSfG7nDaQw=; b=V+50VwXYkpfxid2rTQQGjL8XzNIAbeO3XycUJe7XxyAx2VlAWd7DQ5kipUkkRzV+xw 9HYFMVlIoKuY0Kiig4CK3kAPmuoSLH+LUPG6l0d+Vloc2SqZvHX+4nYdItZSAYs+ylNs LrWNcu3DGbL2y0tocqxg1SiGTZi/gvpd3xvgR5CRKrlBg0ggUh/YZ8rgjBZ56xIdW5l1 7wS56cwmbF88SyiBKWAz98wbeY0CDn+sDUk5iFFxxJT1eziCx3f+fCSO4n9/fVrMvct6 UjxiVzrhNqXjaGOA+MjRTWOrUXRRX3NnijGnmueaGKo1I421XJc7oAIwQDCcLa3TzvVr Bkfw== X-Gm-Message-State: AOAM531zcxicsBXyZkP5iHrq3L2wZb6XX6s2ZwfjsGqvSZ6Mrj1eFnot 3xjcil31FsHpVmhKOqFHUAZ81GmkkUoapX2itHyNOyG76VhMwaZB5/WJtB5nzzPPrNAhLdCgDHs K66qJCOdVqN+fqxrA3nmdiH4X X-Received: by 2002:adf:f6cf:0:b0:1ea:974c:5872 with SMTP id y15-20020adff6cf000000b001ea974c5872mr6966423wrp.137.1645809402870; Fri, 25 Feb 2022 09:16:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXx5A60UE9bSbsJtmz6yBBUyF01KuIRzC/+KWkCh/rgkzYR2n5w0NZUd2liWK8OQbwdv8QbQ== X-Received: by 2002:adf:f6cf:0:b0:1ea:974c:5872 with SMTP id y15-20020adff6cf000000b001ea974c5872mr6966409wrp.137.1645809402641; Fri, 25 Feb 2022 09:16:42 -0800 (PST) Received: from Keschdeichel.fritz.box (068-133-067-156.ip-addr.inexio.net. [156.67.133.68]) by smtp.gmail.com with ESMTPSA id f12-20020a05600c154c00b0037df2e5d8c9sm3533984wmg.27.2022.02.25.09.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 09:16:42 -0800 (PST) From: christian.ehrhardt@canonical.com 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 19.11.12 Date: Fri, 25 Feb 2022 18:15:10 +0100 Message-Id: <20220225171550.3499040-17-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20220225171550.3499040-1-christian.ehrhardt@canonical.com> References: <20220225171550.3499040-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 19.11.12 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/27/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/6f93f1756f48fe7801516a8f2346aa905b6d73df Thanks. Christian Ehrhardt --- >From 6f93f1756f48fe7801516a8f2346aa905b6d73df 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 @@ -37,7 +37,7 @@ pushpull_width(int pp) 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))) return NFP_ERRNO(EINVAL); @@ -117,7 +117,7 @@ nfp6000_nbi_ppc(uint32_t cpp_id) 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; if (island && (island < 8 || island > 9)) @@ -281,7 +281,7 @@ static inline int 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) { if (address < 0x2000000000ULL) @@ -316,7 +316,7 @@ nfp6000_mu(uint32_t cpp_id, uint64_t address) 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)) return NFP_ERRNO(EINVAL); @@ -336,7 +336,7 @@ nfp6000_ila(uint32_t cpp_id) 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)) return NFP_ERRNO(EINVAL); @@ -354,7 +354,7 @@ nfp6000_pci(uint32_t cpp_id) 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)) return NFP_ERRNO(EINVAL); @@ -370,9 +370,9 @@ nfp6000_crypto(uint32_t cpp_id) 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); switch (cpp_id & NFP_CPP_ID(0, ~0, ~0)) { @@ -410,9 +410,9 @@ nfp6000_cap_xpb(uint32_t cpp_id) 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); switch (cpp_id & NFP_CPP_ID(0, ~0, ~0)) { @@ -540,11 +540,11 @@ nfp_target_cpp(uint32_t cpp_island_id, uint64_t cpp_island_address, const uint32_t *imb_table) { 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); if (island == 0) { -- 2.35.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-25 16:58:44.957441928 +0100 +++ 0017-net-nfp-remove-useless-range-checks.patch 2022-02-25 16:58:44.216990391 +0100 @@ -1 +1 @@ -From a52c79642ab4296763189dd8efadbb679d32c9a0 Mon Sep 17 00:00:00 2001 +From 6f93f1756f48fe7801516a8f2346aa905b6d73df Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit a52c79642ab4296763189dd8efadbb679d32c9a0 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org