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 4CDABA0093 for ; Tue, 19 May 2020 14:59:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 41EB11D61A; Tue, 19 May 2020 14:59:29 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 673B41D61A for ; Tue, 19 May 2020 14:59:28 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id h17so15774168wrc.8 for ; Tue, 19 May 2020 05:59:28 -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=oxlM12SnP8N37TicrtqRMxFlJz2CpVy7tQwL09zCz5s=; b=P24rlbOW0DpqnnVjm6Xfv3yFsqyZETlDBUC+A1XP3bTpGec42gFIZi/LPZMNv+uoU7 eT+y7HTpfa1NNvpQavTrVKhESopp7/ClNEMUrKJ8Rtt9f4KV4bt22BPUvQjXAaehfw70 1uoPsh7P245+02GbLhp8ltZqriBCF4GIif8A3tKm8wtBUX2ohM8KSEENaRAgHEZO1VLv w/uJw/Nwo4Epb71+YNp5TctYqKY9eRTcUmtc5GnTZowb+GmzZOZYV39YMHsFcoTY6TIc BlLa5+DD/yxyOx6GAs/eSmRtqdzIh41e0lzktIJl7iVY/xw47q8Td9Jcr90z7rciVRRI Empg== 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=oxlM12SnP8N37TicrtqRMxFlJz2CpVy7tQwL09zCz5s=; b=DrpAsXqowQ51ExKoYv3u0JjVcxcYg3kO2lPxvG/Q0Am/WewuecZt6PJ5VRBz4Vv3Vc JB1N9vQs1q9pgp0ZeU5H9Frqs8bdkzyX88jBXVmnYPlHXMYS/+3c00m5dBhjhxO5AJmv 0CSBbvCY77Vo/oPgpxSafglT0GiR+mmUoO3lqcaCVf9lIMy/81YrlPYLhIGotmn6AnNv Cr5XDaqcHZDWvuJPpIBraPqs74WBYN3kyCjmSCvPRoB1SYWv3QjUbCTUSCg1i4ndTLd0 TzOVyOmIfOpmux4TtdDGXKCOdEvzOBpY7yYKPso15N2yxz0CmDVpECMHv6KAXXEpNuk6 Bc3w== X-Gm-Message-State: AOAM530yFk/bPw0iw8gde1XTYHQUCmT9QOHnmTOF3ZrUiWQ5Hlvhw7Yf Qfk7foebTC9Q+Mex81t+Xsuvnizl2OwWd8/o X-Google-Smtp-Source: ABdhPJwsDPDSwtJ8JV4/btu8YrCgGcikgusg2lpx+cHg7kZSbyU95tYojjQ49kXy4D4C2AoDKwCoiQ== X-Received: by 2002:a5d:4d46:: with SMTP id a6mr26935961wru.188.1589893168156; Tue, 19 May 2020 05:59:28 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id p23sm1268602wma.17.2020.05.19.05.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 05:59:27 -0700 (PDT) From: luca.boccassi@gmail.com To: Kevin Traynor Cc: Ferruh Yigit , dpdk stable Date: Tue, 19 May 2020 13:53:45 +0100 Message-Id: <20200519125804.104349-35-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519125804.104349-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hinic: fix repeating cable log and length check' has been queued to stable release 19.11.3 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.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/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 32f349234b5ed4e818081c38d90eb88a2750e08f Mon Sep 17 00:00:00 2001 From: Kevin Traynor Date: Fri, 6 Mar 2020 12:06:52 +0000 Subject: [PATCH] net/hinic: fix repeating cable log and length check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit ece8e4c262f8091361e9b261c4e4c6257d2b8bda ] gcc 10.0.1 reports: ../drivers/net/hinic/base/hinic_pmd_hwdev.c: In function ‘print_cable_info’: ../drivers/net/hinic/base/hinic_pmd_hwdev.c:1398:3: warning: ‘snprintf’ argument 4 may overlap destination object ‘tmp_str’ [-Wrestrict] 1398 | snprintf(tmp_str + strlen(tmp_str), (sizeof(tmp_str) - 1), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1399 | "%s, Temperature: %u", tmp_str, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1400 | info->cable_temp); | ~~~~~~~~~~~~~~~~~ The warning is that tmp_str is in both src and dest. Anyway, the current code is incorrect and because of the +strlen the existing string will be repeated twice and max length does not limit to the end of the string. Fix by removing tmp_str from the src of snprintf and adding the correct max length. Fixes: d9ce1917941c ("net/hinic/base: add hardware operation") Signed-off-by: Kevin Traynor Reviewed-by: Ferruh Yigit --- drivers/net/hinic/base/hinic_pmd_hwdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/hinic/base/hinic_pmd_hwdev.c b/drivers/net/hinic/base/hinic_pmd_hwdev.c index b6c821a2ad..fd0292f84c 100644 --- a/drivers/net/hinic/base/hinic_pmd_hwdev.c +++ b/drivers/net/hinic/base/hinic_pmd_hwdev.c @@ -1395,9 +1395,9 @@ static void print_cable_info(struct hinic_link_info *info) tmp_vendor, info->sfp_type ? "SFP" : "QSFP", port_type, info->cable_length, info->cable_max_speed); if (info->port_type != LINK_PORT_COPPER) - snprintf(tmp_str + strlen(tmp_str), (sizeof(tmp_str) - 1), - "%s, Temperature: %u", tmp_str, - info->cable_temp); + snprintf(tmp_str + strlen(tmp_str), + sizeof(tmp_str) - strlen(tmp_str), + ", Temperature: %u", info->cable_temp); PMD_DRV_LOG(INFO, "Cable information: %s", tmp_str); } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 13:56:20.265836942 +0100 +++ 0035-net-hinic-fix-repeating-cable-log-and-length-check.patch 2020-05-19 13:56:18.227501963 +0100 @@ -1,4 +1,4 @@ -From ece8e4c262f8091361e9b261c4e4c6257d2b8bda Mon Sep 17 00:00:00 2001 +From 32f349234b5ed4e818081c38d90eb88a2750e08f Mon Sep 17 00:00:00 2001 From: Kevin Traynor Date: Fri, 6 Mar 2020 12:06:52 +0000 Subject: [PATCH] net/hinic: fix repeating cable log and length check @@ -6,6 +6,8 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +[ upstream commit ece8e4c262f8091361e9b261c4e4c6257d2b8bda ] + gcc 10.0.1 reports: ../drivers/net/hinic/base/hinic_pmd_hwdev.c: In function ‘print_cable_info’: @@ -30,7 +32,6 @@ correct max length. Fixes: d9ce1917941c ("net/hinic/base: add hardware operation") -Cc: stable@dpdk.org Signed-off-by: Kevin Traynor Reviewed-by: Ferruh Yigit