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 C0803A0527 for ; Mon, 9 Nov 2020 19:41:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B6F0C72ED; Mon, 9 Nov 2020 19:41:48 +0100 (CET) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by dpdk.org (Postfix) with ESMTP id CF27A72ED for ; Mon, 9 Nov 2020 19:41:45 +0100 (CET) Received: by mail-wm1-f47.google.com with SMTP id h62so435047wme.3 for ; Mon, 09 Nov 2020 10:41:45 -0800 (PST) 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=cbSVG06IhzOnff2biejKuOc/7Oj2jUiVHKMdjv1tZNo=; b=iQdPlD0cDozaImnxFUCKTTfdc9sNp4ZvywluBUEcs8MrLDym0HidvCk/Bi7yqAkN/x Uz/rdyePiQKkX5lXabMoEsvn5YhMHeeJSZ2/ZRDw05Vsg4gqV92fiAVs/+HAJplK0ofB rffdIhYLP62xU9CFVwcUHpfz+ppLh6PhgHGIa+0aThQztpwcCyT3MipSHwwTUlKrwbA3 eYMQa+p/rWUJCLMcR33FQvWTDM9MOeun2hO1GdnR/BVSuev4YxK4pRV+P/QMSHwY84Gz jpCNBCNJA2wYoRgdHpFzF7Gv4YPi2gkemR+s729Fr4mG+GczGMI+sWIiYStA9hOPYP1z oBZA== 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=cbSVG06IhzOnff2biejKuOc/7Oj2jUiVHKMdjv1tZNo=; b=FinylN3tGbARyp3fHufj/jRI/EuwPjqVOULfBDBWyPZcWVQTjFKFnbVGJtYG29hbt3 fU7VOu58pWf0owVHk7qCGOogSnfzNnE0RPXZ+6OzlqRVjjh1vFBx+Kq2v6XDDLusMun2 nokPIfx6WqprwKXU4Rwnoz1gHtT1rTh7VYXsn+oqhINBf3byXCy7RdyVi8vZhjeJ09NO H4v4Y2s04M0YWedQtdqMxuCHJNsNDRGQWlZ+YeLjXyuP+Lic4T7gQbFOfgNAkB6eSGfs BNQA8VTk6ow6AW5PTEnDH4JGZYipKnGhnGXHZcLVt2QsYTHss2btf++RTOL5S9L9K4dK XNYQ== X-Gm-Message-State: AOAM531CE2I3tp/YMcLO2CidE9qRfEi4zD8jkwvZv9ev4WsEB5DIXwN0 ESHmrMGHMt/LEooxWfOsEaUR/DiYpkAYLw== X-Google-Smtp-Source: ABdhPJxmrqFoSON9I0yHMxlAgD5GfHiidztSdocQ7VXV9ln3rVGQCE7h/DTTxXrmYx2nYHg8QOpL6g== X-Received: by 2002:a05:600c:255:: with SMTP id 21mr545441wmj.69.1604947305613; Mon, 09 Nov 2020 10:41:45 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id y185sm299511wmb.29.2020.11.09.10.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:41:44 -0800 (PST) From: luca.boccassi@gmail.com To: Bruce Richardson Cc: Radu Nicolau , dpdk stable Date: Mon, 9 Nov 2020 18:39:57 +0000 Message-Id: <20201109184111.3463090-9-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'examples/multi_process: fix build on Ubuntu 20.04' has been queued to stable release 19.11.6 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.6 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/11/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. 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/200a950019a983933ada6425ded00314337c28a4 Thanks. Luca Boccassi --- >From 200a950019a983933ada6425ded00314337c28a4 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Wed, 28 Oct 2020 16:27:01 +0000 Subject: [PATCH] examples/multi_process: fix build on Ubuntu 20.04 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 27b549c12df2ef2db6b271795b4df7b14a2d9c2c ] Two warnings are reported by gcc 9.3.0 on Ubuntu 20.04. When producing a printable mac address the buffer was appropriately sized for holding the mac address exactly, but the actual snprintf included a '\n' character at the end, which means that the snprintf technically is getting truncated i.e. the \n would not be added due to lack of space. This gets flagged as a problem by modern versions of gcc, e.g. on Ubuntu 20.04. main.c:77:37: warning: ‘__builtin___snprintf_chk’ output truncated before the last format character [-Wformat-truncation=] 77 | "%02x:%02x:%02x:%02x:%02x:%02x\n", | ^ Since the \n is getting stripped anyway, we can fix the issue by just removing it. In the process we can switch to using the standard ethernet address formatting function from rte_ether.h. The other warning is about possible string truncation when getting the RX queue name: In file included from init.c:36: init.c: In function ‘init’: ../shared/common.h:38:28: warning: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Wformat-truncation=] 38 | #define MP_CLIENT_RXQ_NAME "MProc_Client_%u_RX" | ^~~~~~~~~~~~~~~~~~~~ ../shared/common.h:52:35: note: in expansion of macro ‘MP_CLIENT_RXQ_NAME’ 52 | snprintf(buffer, sizeof(buffer), MP_CLIENT_RXQ_NAME, id); | ^~~~~~~~~~~~~~~~~~ This is a false positive, as the value of the "id" is limited to 255, being stored in the app as a uint8_t value, removing the possibility of the %u being replaced by anything other then 3 characters max (rather than up to 10 as thought by the compiler). Therefore, the warning can be easily removed by changing the type of the "id" parameter to the local function from "unsigned" to "uint8_t" also, ensuring the compiler is aware of the range limit. Fixes: af75078fece3 ("first public release") Signed-off-by: Bruce Richardson Acked-by: Radu Nicolau --- .../client_server_mp/mp_server/main.c | 17 ++++++++++------- .../client_server_mp/shared/common.h | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index 802e29d10d..1084b303ff 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -59,12 +59,17 @@ static struct client_rx_buf *cl_rx_buf; static const char * get_printable_mac_addr(uint16_t port) { - static const char err_address[] = "00:00:00:00:00:00"; - static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)]; + static const struct rte_ether_addr null_mac; /* static defaults to 0 */ + static char err_address[32]; + static char addresses[RTE_MAX_ETHPORTS][32]; int ret; - if (unlikely(port >= RTE_MAX_ETHPORTS)) + if (unlikely(port >= RTE_MAX_ETHPORTS)) { + if (err_address[0] == '\0') + rte_ether_format_addr(err_address, + sizeof(err_address), &null_mac); return err_address; + } if (unlikely(addresses[port][0]=='\0')){ struct rte_ether_addr mac; ret = rte_eth_macaddr_get(port, &mac); @@ -73,10 +78,8 @@ get_printable_mac_addr(uint16_t port) port, rte_strerror(-ret)); return err_address; } - snprintf(addresses[port], sizeof(addresses[port]), - "%02x:%02x:%02x:%02x:%02x:%02x\n", - mac.addr_bytes[0], mac.addr_bytes[1], mac.addr_bytes[2], - mac.addr_bytes[3], mac.addr_bytes[4], mac.addr_bytes[5]); + rte_ether_format_addr(addresses[port], + sizeof(addresses[port]), &mac); } return addresses[port]; } diff --git a/examples/multi_process/client_server_mp/shared/common.h b/examples/multi_process/client_server_mp/shared/common.h index 6dd43fcac2..76beca0101 100644 --- a/examples/multi_process/client_server_mp/shared/common.h +++ b/examples/multi_process/client_server_mp/shared/common.h @@ -43,7 +43,7 @@ struct port_info { * Given the rx queue name template above, get the queue name */ static inline const char * -get_rx_queue_name(unsigned id) +get_rx_queue_name(uint8_t id) { /* buffer for return value. Size calculated by %u being replaced * by maximum 3 digits (plus an extra byte for safety) */ -- 2.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-09 18:40:11.580647101 +0000 +++ 0009-examples-multi_process-fix-build-on-Ubuntu-20.04.patch 2020-11-09 18:40:11.075310411 +0000 @@ -1 +1 @@ -From 27b549c12df2ef2db6b271795b4df7b14a2d9c2c Mon Sep 17 00:00:00 2001 +From 200a950019a983933ada6425ded00314337c28a4 Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit 27b549c12df2ef2db6b271795b4df7b14a2d9c2c ] + @@ -50 +51,0 @@ -Cc: stable@dpdk.org @@ -60 +61 @@ -index ec7f6b11f3..b18e12dd4b 100644 +index 802e29d10d..1084b303ff 100644