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 A5C2FA0548 for ; Sun, 28 Nov 2021 16:02:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F2664068A; Sun, 28 Nov 2021 16:02:43 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2059.outbound.protection.outlook.com [40.107.94.59]) by mails.dpdk.org (Postfix) with ESMTP id 27EF24068A for ; Sun, 28 Nov 2021 16:02:41 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VNwn1yvVJmDY8Dup6K1W8hvsK33lFdDzb2hpswv1JcNAWaAFr1CMs5+VRKnMgxPoXjnA0i/8O1CILgIacFcs6OEMXen65ucvCf6qwd8wZC5Sg0rANOrBEr1KHVk2QOxDyDAzUpZhSoLdGGZSERNEKlZJ+/9PcEuICArbfU3AOYiJnJ0Gbw8e9Qg2LOAzZYtqn8NhPJgIjSpJ0OXpCS5NNMOm64yzP8CKoTjKEhdhJekrKeLyMATVfPobzKgpMups/Ssdn0OhHgnpfQOBVifI0X4CwmzMN0hcLmw6VrFgw7WgVaTmyUR4py3uZ5yxNg2qLvPbx/ztH34KK7SY7Hbv2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ceqnBS7PYS7WtSIxQu6GCwNYPhgcPYYgEAbSK3tXNXs=; b=g/GL+hzRvJQC+Qakow4XL8li4JZ6R3qaanf/hQSK3RvHXHY95RIX6+L7rd+mC/ilYD3rmUQisTSBSDmCoxGTRgxChNj0o75F9koHD/JQ835DwRZM2KTTuydh82sf9/A5FO6SPaq9RAjYXeUaqOSyCDn6mBAxK/Jc87LeGQfVBQtLE0V5pRRFHa0ftwJfswVVykPmbwax4UfOoBLt19G7JyPp7SXM3IHh45JUr9VzDvEEzbdWJgWpvtEgNHjp6CHypxYDb/30feMWAkU0fHeBAuQfAxRB56xtXhoBsH+SF+XF+/ID94hXSL7nNvfEmbiSak0V+uNajglSiyl8ek0YsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ceqnBS7PYS7WtSIxQu6GCwNYPhgcPYYgEAbSK3tXNXs=; b=fi0Igwf2zI7QrdmZ2Gjngy5I4PAByLDbJYxiOybr/0ujVjODvMglmJCvon1f63bg7b1p/uizAIF4doCLcm99QLMwK/GXC18OzqDzJM4/hTNdPB4IDZekt3zR4ck2fLXBqkebmD0FmtlXIwkpXQz3oiM4+OPJ7s3P8doEZYMrCYJFa47rtuukb1mQuzrXVYVkVWFsqJSciGmDZQhzlCrc/rvdadK4OB7FXf7iTAxDAsWFh1YxHRFKzCaEszGn76QqnmpO2hwja9ewGDPa2IKqwWuqycb/jS3n8V79PViMfM4AFMU72MqY4FqmZChj304KDwYv0c7E28mkFj6wwMlDzw== Received: from DM3PR11CA0001.namprd11.prod.outlook.com (2603:10b6:0:54::11) by BN8PR12MB3361.namprd12.prod.outlook.com (2603:10b6:408:67::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Sun, 28 Nov 2021 15:02:39 +0000 Received: from DM6NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:0:54:cafe::3e) by DM3PR11CA0001.outlook.office365.com (2603:10b6:0:54::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23 via Frontend Transport; Sun, 28 Nov 2021 15:02:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT050.mail.protection.outlook.com (10.13.173.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4734.22 via Frontend Transport; Sun, 28 Nov 2021 15:02:39 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 28 Nov 2021 15:02:37 +0000 From: Xueming Li To: Gregory Etelson CC: Luca Boccassi , Viacheslav Ovsiienko , dpdk stable Subject: patch 'app/testpmd: fix hexadecimal parser with odd length' has been queued to stable release 20.11.4 Date: Sun, 28 Nov 2021 22:54:15 +0800 Message-ID: <20211128145423.3974892-72-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211128145423.3974892-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> <20211128145423.3974892-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2c47049-2803-45ba-d459-08d9b2801ed9 X-MS-TrafficTypeDiagnostic: BN8PR12MB3361: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WXUqSgDGfY3xNjFe6qJIG5wAlGxttyxmUxp3R6M1PUbCFUROHviRnsOBYneYeWMZV8xxVfblGoXI5nAp458JuuoHGS7bccssTVY8LcpnBZ+vWOhQvwqxapZ36lhISxW9SFGWmQzCjgpRmouEpvrqw0UYV3nCsAcKbhFuTtgI2Y0B9OCCVJLZl4LG4kHUpVD+Z2z61xp+yET79Gahl+9AUdgZ+oQlWto2G0KUq/UvF/HEPwuB+GfG0pE4uV6HMe+w6IcikKplCJ31BGx6jtzB6HIGBq1v3r/ptDtKhHXskpHobpqwgMLrOTUv8OXk5VKbCC6bH9SpUw3pIc9045cnflAG92ZbzrIjLOFAIF+Fa+77orujA5H/bQ6fqtsUS3Q++/Uc5B7ItA6DeM8aT1Sg9Yqc7sMUB+cftCJTMUwxs3ci3y1GNxJLqDukVqhVG4NqbwXo/HxO6fWSOkFKsYWdreXcU1mf4dUrOwFDPIL1jZ4/G3f8LXerE/rHpegAsOUfAl/gAKL09Xdv9mLtpBrejbZT49rsh7SYtE+3NKJ5MqL+WFtXSOYikAY301aVmWal5vu2eHyJPSi0eNgcdHDU/rwENKCKNBU+DPbEdmU6dQoStYs7qqjJxy7CY24Xal7TJmNJFXzS/H5ymbQIDogau9bpWWFoduAhLm7H7BRTR32GwAmaJ+aqhNeYMbzxaSsFDSOPHZLp6whzUDtvgeZ85L952KSBhI5jQawxFfz+qWaryHLYCm+zPrMEQguLaq7RQLeSCyjXpc8bQiBHCzyZAIwaELesOxbJR2hnlLhucMeN5kiorsxrAbDyDfkIR1D6AtcVJrFObK93iNF37f1s3w== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(316002)(37006003)(336012)(36756003)(6636002)(1076003)(6862004)(8936002)(356005)(70206006)(4326008)(36860700001)(7636003)(47076005)(2906002)(8676002)(83380400001)(5660300002)(86362001)(6286002)(426003)(6666004)(508600001)(55016003)(82310400004)(4001150100001)(186003)(16526019)(26005)(7696005)(966005)(2616005)(70586007)(53546011)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2021 15:02:39.1586 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2c47049-2803-45ba-d459-08d9b2801ed9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3361 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.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 11/30/21. 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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/a6f7eb3e2079ba5141b8b06f1da2946a0577eecf Thanks. Xueming Li --- >From a6f7eb3e2079ba5141b8b06f1da2946a0577eecf Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Wed, 24 Nov 2021 14:33:54 +0200 Subject: [PATCH] app/testpmd: fix hexadecimal parser with odd length Cc: Xueming Li [ upstream commit ea1da434c0a876b1913b9f0758abd1b6e70a19fd ] Current hex string parser assumes input has even characters number. The parser fails input string with odd length. The patch parses hex strings with even and odd length. Parse result of an input with odd length will match result of even length input, that has `0` as MSB, following by the original sequence. For example: "0x1" results in *dst={0x01, 0x00}, *size=1 "0xabc" results in *dst={0x0a, 0xbc, 0x00}, *size=2 Fixes: 169a9fed1f4c ("app/testpmd: fix hex string parser support for flow API") Signed-off-by: Gregory Etelson Reviewed-by: Viacheslav Ovsiienko --- app/test-pmd/cmdline_flow.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index bbf62be5ae..6ff6391146 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -6411,9 +6411,8 @@ error: static int parse_hex_string(const char *src, uint8_t *dst, uint32_t *size) { - char *c = NULL; - uint32_t i, len; - char tmp[3]; + uint32_t left = *size; + const uint8_t *head = dst; /* Check input parameters */ if ((src == NULL) || @@ -6423,19 +6422,23 @@ parse_hex_string(const char *src, uint8_t *dst, uint32_t *size) return -1; /* Convert chars to bytes */ - for (i = 0, len = 0; i < *size; i += 2) { - snprintf(tmp, 3, "%s", src + i); - dst[len++] = strtoul(tmp, &c, 16); - if (*c != 0) { - len--; - dst[len] = 0; - *size = len; + while (left) { + char tmp[3], *end = tmp; + uint32_t read_lim = left & 1 ? 1 : 2; + + snprintf(tmp, read_lim + 1, "%s", src); + *dst = strtoul(tmp, &end, 16); + if (*end) { + *dst = 0; + *size = (uint32_t)(dst - head); return -1; } + left -= read_lim; + src += read_lim; + dst++; } - dst[len] = 0; - *size = len; - + *dst = 0; + *size = (uint32_t)(dst - head); return 0; } -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-28 22:41:06.816987317 +0800 +++ 0071-app-testpmd-fix-hexadecimal-parser-with-odd-length.patch 2021-11-28 22:41:03.430205655 +0800 @@ -1 +1 @@ -From ea1da434c0a876b1913b9f0758abd1b6e70a19fd Mon Sep 17 00:00:00 2001 +From a6f7eb3e2079ba5141b8b06f1da2946a0577eecf Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit ea1da434c0a876b1913b9f0758abd1b6e70a19fd ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org @@ -27 +29 @@ -index 1b00ae507b..bbe3dc0115 100644 +index bbf62be5ae..6ff6391146 100644 @@ -30 +32 @@ -@@ -7702,9 +7702,8 @@ error: +@@ -6411,9 +6411,8 @@ error: @@ -42 +44 @@ -@@ -7714,19 +7713,23 @@ parse_hex_string(const char *src, uint8_t *dst, uint32_t *size) +@@ -6423,19 +6422,23 @@ parse_hex_string(const char *src, uint8_t *dst, uint32_t *size)