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 980E2A0C41 for ; Tue, 30 Nov 2021 17:44:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90A33411CB; Tue, 30 Nov 2021 17:44:17 +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 E657241170 for ; Tue, 30 Nov 2021 17:44:16 +0100 (CET) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (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 BE37D40037 for ; Tue, 30 Nov 2021 16:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638290656; bh=66VgS20SBo/cqICTvxkMCJkO39SCmqQa4gDN0HjEdKo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=shyzX6BvhfSCLOx0CVNvYmCgH5OlyAXAWwzrHfxQ2oo8WGoKddkwv0jIXAl7Zq5Fe C5hXgaFHNP1Dt6Nw368IQhsfSM0tb6CdDDSMM/fS3Lgn1ubW6OMsXOE2Fs0RgWgisv duhE+6t1bATtmCQzZKTWx5Yxqvo+z2Bw5R16f/3P0nPVLDjN3QJTfgdt1jNdw/1fLN Q9WWH4sNA7/M8q32335MpQXReFieyUJL4I6gZZFC3iW5yTM7wLRmlYMMv3CNMszi6q kvo9kp8hmn51x2yGVsOD6Nlsj10qGFuBUK9Sn7/qojtLM3+z8QIE6mhFHJJYey9eJ7 7IVhedbXcWVMg== Received: by mail-ed1-f72.google.com with SMTP id y9-20020aa7c249000000b003e7bf7a1579so17446741edo.5 for ; Tue, 30 Nov 2021 08:44:16 -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=66VgS20SBo/cqICTvxkMCJkO39SCmqQa4gDN0HjEdKo=; b=Hdfp6aqu/wr02LgrMrjedDf7tGR/Ia50EZ5JUwiTaDXr7EnUKrOCm7B0yR2Ei4lp+H hPuSa7ef85tmWwxCGc/BsYS1zToZfQxG+ttscsH3c/lW1w99sv14ybRNwH1Ox+B0voBV 5xGl+8i9Ie8M8/xOZUUe7JoBc8NninsfycXmtqtDhkLHtmZxEptdZUyHm/dkvPcsIp5Y EXMht7Kc1kXz/IzND+CD7LQ24LGKlojHS7t3xxvoTkSaWgf0fPpJFCh9QbiGuK8QjEK5 O2+Vi6C6YES2xfHiIfNIqtxIT1+S/fVssma1h+a6W7vPRAVQIoPostttyNzzKl3+miFX xLzg== X-Gm-Message-State: AOAM532c0hyoCcKdAfVXHrYfeTLuxeTTKs8NxLVdfVuDAnV6avnz8YvV Z5E7/gYyjAzt4rF9iOzRhDB5qawSBU91moBeqX/sQFfJYRAgmNnDj+mQpqptf5nq7YE2O8zqFDn oFdI96hl8wA190nEqn6SqK+Pi X-Received: by 2002:a50:e18e:: with SMTP id k14mr83700edl.147.1638290656062; Tue, 30 Nov 2021 08:44:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUpwCmr4fL+VXRUcUFmCkqlU0N7xAO35Fb8VfjOIyaIXrnKJHltF4oXNYwX10FZyzngNg0Ww== X-Received: by 2002:a50:e18e:: with SMTP id k14mr83687edl.147.1638290655933; Tue, 30 Nov 2021 08:44:15 -0800 (PST) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id d23sm3907796edq.51.2021.11.30.08.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:44:15 -0800 (PST) From: christian.ehrhardt@canonical.com To: Gregory Etelson Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'app/testpmd: fix hexadecimal parser with odd length' has been queued to stable release 19.11.11 Date: Tue, 30 Nov 2021 17:36:03 +0100 Message-Id: <20211130163605.2460997-159-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> References: <20211130163605.2460997-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.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before December 10th 2021. 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/86e6d758ac906b310e04ec9ad3c3b8602aec5aec Thanks. Christian Ehrhardt --- >From 86e6d758ac906b310e04ec9ad3c3b8602aec5aec 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 [ 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 4d99ae518d..df9183376c 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -5293,9 +5293,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) || @@ -5305,19 +5304,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-30 16:50:15.184356160 +0100 +++ 0159-app-testpmd-fix-hexadecimal-parser-with-odd-length.patch 2021-11-30 16:50:06.150876172 +0100 @@ -1 +1 @@ -From ea1da434c0a876b1913b9f0758abd1b6e70a19fd Mon Sep 17 00:00:00 2001 +From 86e6d758ac906b310e04ec9ad3c3b8602aec5aec Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ea1da434c0a876b1913b9f0758abd1b6e70a19fd ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -27 +28 @@ -index 1b00ae507b..bbe3dc0115 100644 +index 4d99ae518d..df9183376c 100644 @@ -30 +31 @@ -@@ -7702,9 +7702,8 @@ error: +@@ -5293,9 +5293,8 @@ error: @@ -42 +43 @@ -@@ -7714,19 +7713,23 @@ parse_hex_string(const char *src, uint8_t *dst, uint32_t *size) +@@ -5305,19 +5304,23 @@ parse_hex_string(const char *src, uint8_t *dst, uint32_t *size)