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 CAD28A0032 for ; Fri, 18 Feb 2022 13:42:03 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C64C641140; Fri, 18 Feb 2022 13:42:03 +0100 (CET) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mails.dpdk.org (Postfix) with ESMTP id B935540E2D for ; Fri, 18 Feb 2022 13:42:02 +0100 (CET) Received: by mail-wr1-f46.google.com with SMTP id d27so14402471wrb.5 for ; Fri, 18 Feb 2022 04:42:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+yEI1vD0PsoOUyO7d7qlB4yB97bT2BI8EGqniQAk47M=; b=KT28gKwGOZGS5++s43/Ze/Cnjg4wCo9rvNNtRVJsMZGtGLNAv+2db3HAKb4eCKtERA rpTGC06gxu03O9b87Sj77ps9tVbT/X9Fwq9BSzSxPtCqnIbwqJIYzFAPzYIYemRxf3yV IiK+M2TSRwDFBsuW64j5ekblW/r1JtcjhT8eWrnkvQ95mNcn3O7m8T1BCATES8wej+7i n1EkJu9749HZI55sX1EemxruDC/KCn/u7fzKvcSoXYndqypGrXrggbdDALAy9Da53ms6 Gaw6/NDRbXaiVTyY1pTDYCLWWPNA1XVp89Eq5rut4/BI5kSMNizLb/cdfnZ6SVRRlyTo uIQw== 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=+yEI1vD0PsoOUyO7d7qlB4yB97bT2BI8EGqniQAk47M=; b=ej2mloUuYm3wCxjm/emeXZPCE6kpfBhBdhOTA9BI7IsqmWD/Cmb/u7NErPCMUtB6fW mHvB5Rp8QFqNK//R+de1qMnZNomw1lkg4yedi3wQyjy47m4ezKz3wgWR6F6KkF2HTSh1 Gb1VH3596mw03mgbQKa9xkks7DRJ9YLVNtoexjnjQhp8BDm3awP3ZvnLMxDfQqWczuyd 4G8LgL8memBMsicdcxUYSPaO3jGuPCJIa39ShOpo8Jzi3PviR33aKp5yyVR5mem6RFup xx+BsI4bFaVq8vGkuHSLwGcfE5UaU9Yqy+a3poGsBYdH/LzLphGFKwlhi6kKRtQ/SrIv m8SQ== X-Gm-Message-State: AOAM531kpacmSuCYzTLZomCuzpXbJhJcsxZ8D/6wzCZhp9iswBVmCWvK f7ngVf8YACmqExOLWu3Agxg= X-Google-Smtp-Source: ABdhPJz24+/sEtUeLgYR0in6Mqd+j1l9WC3aGv9cvZNdzgrOdvWtz4bgEpc5Y7hTNVpEp+mUqJwsKA== X-Received: by 2002:a5d:518d:0:b0:1e5:8cc9:5aa4 with SMTP id k13-20020a5d518d000000b001e58cc95aa4mr5685796wrv.119.1645188122391; Fri, 18 Feb 2022 04:42:02 -0800 (PST) Received: from localhost ([2a01:4b00:f41a:3600:360b:9754:2e3a:c344]) by smtp.gmail.com with ESMTPSA id b15sm40213829wri.96.2022.02.18.04.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 04:42:01 -0800 (PST) From: luca.boccassi@gmail.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 20.11.5 Date: Fri, 18 Feb 2022 12:38:16 +0000 Message-Id: <20220218123931.1749595-47-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220218123931.1749595-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-1-luca.boccassi@gmail.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 20.11.5 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/20/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/238f205dd5c574ec8583dc95b753eebbd5e0af70 Thanks. Luca Boccassi --- >From 238f205dd5c574ec8583dc95b753eebbd5e0af70 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.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-18 12:37:39.877005113 +0000 +++ 0047-net-nfp-remove-useless-range-checks.patch 2022-02-18 12:37:37.662791295 +0000 @@ -1 +1 @@ -From a52c79642ab4296763189dd8efadbb679d32c9a0 Mon Sep 17 00:00:00 2001 +From 238f205dd5c574ec8583dc95b753eebbd5e0af70 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit a52c79642ab4296763189dd8efadbb679d32c9a0 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org