From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF264A0518 for ; Fri, 24 Jul 2020 14:02:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A58191C05C; Fri, 24 Jul 2020 14:02:14 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id CEC641C05C for ; Fri, 24 Jul 2020 14:02:12 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id 3so1107394wmi.1 for ; Fri, 24 Jul 2020 05:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Evuk0eFsQZvINTolhzc8vGTrWDSVyE+/ukVqxO4DQ0M=; b=lxY8FRUdTaWTeyGksUwoTZLSq96JNiPh197YWXDJTHcxTk77M4jQAEG8pIsS+7rht2 zWH3ittyIboNuECs+vfVzQscDWZL6P2HhLFOJCvK0q3OpnU9dOHOf/LPaHLbHlqcUkPR OzZ9X/4J8QspJTpxHwE9Te300p0ejVSjAKCja1K7sJdFk7oyXgyFg/vqDPE5nxUPCH6i RCcu+XHSqeuKyU6XqYdQmg/4MnTVfSZuOZ901aygUccnjvEK1nQBZjKALkStQwFjTI/1 8uJ233lkX36Ojw+6asvgoa/lTJ56qCP6Ui9CLuLHOrrgw9s2vtz80rJro+97nvAllqvZ 6NeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Evuk0eFsQZvINTolhzc8vGTrWDSVyE+/ukVqxO4DQ0M=; b=e1ZgnxFPKBRB7BJNqFAqXUPvGp08r3+nF6fEglGNOCLySwbR1kjQ4xEjU/bz3xwie/ tlZ4lu2J02mUzchSlj1Ma3rYz6p/A9p5Q1wSnlBjUrXrXaOzF43Q1rlS+WnbcROY2uHQ 950F8OLgKWexFzPBHqxfzcUX2eF6hFLPj7AxXPfK8X20H72ZtzVJlhGHIfK6Xe5SgSHd aBD1jxShiARXpxu5m7yD5t4YLb5WGPXW3gC9wiVqDOSrQaJE+dXbCqQ/wudC2NwYWJKw SOJ+3duA9S6GXaXHZsQc0d4KN44QYomXM5TG6G6MQGxqUvAlBJh3YU8kJvivaq1UXmca oJQg== X-Gm-Message-State: AOAM532/b9ZO4yGpWcLc3eACn7TvGEXXURdjMW7ZSlME3FNORxQTes08 ifuR0RD8+zEuJ/qIVPIsh7I= X-Google-Smtp-Source: ABdhPJzllLF8nAf+1PQVO41RhK1Q4u2OsaOaAN0qaDtDuUh2T9WoDVFPnN0Fy88F4Wk4Q+NqvkvFEg== X-Received: by 2002:a1c:5ac3:: with SMTP id o186mr8362213wmb.39.1595592132510; Fri, 24 Jul 2020 05:02:12 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id y17sm1170952wrh.63.2020.07.24.05.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:02:11 -0700 (PDT) From: luca.boccassi@gmail.com To: "Wei Hu (Xavier)" Cc: dpdk stable Date: Fri, 24 Jul 2020 12:57:47 +0100 Message-Id: <20200724120030.1863487-29-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hns3: fix unintended sign extension in fd operation' has been queued to stable release 19.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/20. 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. Thanks. Luca Boccassi --- >From 9cd77fe6e7ea86eeac5dc7f8eff407e3c14ec8dd Mon Sep 17 00:00:00 2001 From: "Wei Hu (Xavier)" Date: Tue, 9 Jun 2020 16:44:16 +0800 Subject: [PATCH] net/hns3: fix unintended sign extension in fd operation [ upstream commit 5c471cb581ebd9a06918dbf5092f4228cc1e565e ] Currently, there are coverity defects warning as below: CID 349937 (#1 of 1): Unintended sign extension (SIGN_EXTENSION) sign_extension: Suspicious implicit sign extension: port_number with type uint16_t (16 bits, unsigned) is promoted in port_number << cur_pos to type int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If port_number << cur_pos is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. CID 349893 (#1 of 1): Unintended sign extension (SIGN_EXTENSION) sign_extension: Suspicious implicit sign extension: vlan_tag with type uint8_t (8 bits, unsigned) is promoted in vlan_tag << cur_pos to type int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If vlan_tag << cur_pos is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. This patch fixes them by replacing the data type of port_number and vlan_tag with uint32_t in the inner static function named hns3_fd_convert_meta_data of hns3 PMD driver. Coverity issue: 349937, 349893 Fixes: fcba820d9b9e ("net/hns3: support flow director") Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_fdir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index 79f3f0d14..98a044f56 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -619,7 +619,7 @@ static void hns3_fd_convert_meta_data(struct hns3_fd_key_cfg *cfg, uint8_t *key_x, uint8_t *key_y) { uint16_t meta_data = 0; - uint16_t port_number; + uint32_t port_number; uint8_t cur_pos = 0; uint8_t tuple_size; uint8_t shift_bits; @@ -637,7 +637,7 @@ static void hns3_fd_convert_meta_data(struct hns3_fd_key_cfg *cfg, rule->key_conf.spec.tunnel_type ? 1 : 0); cur_pos += tuple_size; } else if (i == VLAN_NUMBER) { - uint8_t vlan_tag; + uint32_t vlan_tag; uint8_t vlan_num; if (rule->key_conf.spec.tunnel_type == 0) vlan_num = rule->key_conf.vlan_num; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-07-24 12:53:49.729579730 +0100 +++ 0029-net-hns3-fix-unintended-sign-extension-in-fd-operati.patch 2020-07-24 12:53:48.219005193 +0100 @@ -1,8 +1,10 @@ -From 5c471cb581ebd9a06918dbf5092f4228cc1e565e Mon Sep 17 00:00:00 2001 +From 9cd77fe6e7ea86eeac5dc7f8eff407e3c14ec8dd Mon Sep 17 00:00:00 2001 From: "Wei Hu (Xavier)" Date: Tue, 9 Jun 2020 16:44:16 +0800 Subject: [PATCH] net/hns3: fix unintended sign extension in fd operation +[ upstream commit 5c471cb581ebd9a06918dbf5092f4228cc1e565e ] + Currently, there are coverity defects warning as below: CID 349937 (#1 of 1): Unintended sign extension (SIGN_EXTENSION) @@ -25,7 +27,6 @@ Coverity issue: 349937, 349893 Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org Signed-off-by: Wei Hu (Xavier) --- @@ -33,7 +34,7 @@ 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c -index 7bc5bf831..6ab439d06 100644 +index 79f3f0d14..98a044f56 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -619,7 +619,7 @@ static void hns3_fd_convert_meta_data(struct hns3_fd_key_cfg *cfg,