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 3CF4448B5B for ; Thu, 20 Nov 2025 17:23:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B884402D4; Thu, 20 Nov 2025 17:23:36 +0100 (CET) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 8027B402D4 for ; Thu, 20 Nov 2025 17:23:34 +0100 (CET) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7b9a98b751eso912692b3a.1 for ; Thu, 20 Nov 2025 08:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1763655813; x=1764260613; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HZrNRy62Y/3uEVlnGGFDz0O+sNq5b+/fNCoB1oR2J8c=; b=POl8GlYSvU5lPK3msOPI4lWH9p/Lwt/+s0SIwOgc70PNyq+4Ole5G4ijNmVlblyW5D PUYtcwk3hBw+KYoOalQNUzyS9D1QgbAHsw20Syb+2Opk8S99mwvCmevTl4CjocYh2cUH JVRyB453s5JCezgvikDTLfm0cZEMCqj5RnqT+KlFTwrC6aqLhlNIpUApf/XXbyQ+pgMk BzmcTfaz275sFfxYWCpnv98+WW+jcw/Fuc1nC2bpkKb9J00GZSZCfMay6YiksafhcCi1 JxyHBVWerEn9f2ovvAGtmgGUxF2QMRIKBzAZAKd/11OEiVpv177b/Lndwx0mK8Cszs3c vUBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763655813; x=1764260613; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HZrNRy62Y/3uEVlnGGFDz0O+sNq5b+/fNCoB1oR2J8c=; b=ENZ1R8TU8oygBQqZ7IjqqN4zsGXRewfGKMLbdeeIBrd1a6sXfXJ/y7zrn7J8mfljiy hYaAa7Dw5nQ4g//kBa+bbdRWQzbDgtPLLCTMUnE7ubclD5Jasczv9N6mgQPx/LMijXop 2wIv9V+HeCiuJvwmWSs7gU+ADmwMiJwopf//0KS0i+6jGVOy000GLKEWE0TZDw3gIEKu Z7YEPQbsHIavX0oGyMFlk+U20PGhd5bwXts1YVTO+l6Xl8m90lotgUB9FUmcBv6jEaHX ugBNF8qYrD+NTaquvNLZUvd7jgiwqqLynyjefS/kqCyKtmTzEHGwlMIDWDJIQOcn15kh izBQ== X-Forwarded-Encrypted: i=1; AJvYcCWU68hYmt7gD98Y+hsk1Jy28qxBTh1CCpE3XLdvXCbLDF03P/gPFKYMMdNq+UoxxB/sSg1N3MA=@dpdk.org X-Gm-Message-State: AOJu0YwrR3bpZ15m1yD8M0uxdKLzks3rxVSFvwSG0P7enrCCMr8PIxzD P86MyRIMWOVJwwkvuh6NvFDhxuzTesTikybwGiz4JifxME2Zo4t5DHs+YtbLM1pQQV4= X-Gm-Gg: ASbGnctYe3tGLTUYV8PC7ywHxkwxgCkZZxk8gVU3iRU2HvXrkkg3STqx1N9PqDArupM jkwF3IQCr4lBcysPZC4/THQl2BmEgDGBv5EsrNPNkrItuJFVc1amQRdVqWeRLxJPOBReKRcNCTQ QqcoMNdWe134KqLhpoBpiTQ2LYk0oE1X8GeTzVsOpoyEoV/B5rL4cuDkZ4BlmEvatHD6rUe8kUa Ul9lQeZNQ+Wu9JgamyCfc36KhwqTv6+hubcra2BFzQtf4yoi+ZZ7qHoAk8nA8jLkt89+2hh+r/L rggr/rn6+nqoPmIT5aABcYNNow0aA41dCuXEv+btmOwG688ONHSCt4TDuwNEGtGJrzmvdvLwNX9 Zie15pumktRPzdsQrZMOeI3KcLC6+PxLMjyN8TT9pFlmfYSTZ/3B5UNmi6+cAijs0iHy3hwpTU3 2vqHlZzCZsKN7Paln1nv7xJI74QOp1nKs8rVR9Zx+/8c+s4euwVA== X-Google-Smtp-Source: AGHT+IEQIPmMlr1jo5iXTm374DUH84TSpWj5ABv/0wUpx/Dk+h1Lf8olWYN357n04y2NZqd4F/uOXw== X-Received: by 2002:a05:7022:fb07:b0:11b:9386:a388 with SMTP id a92af1059eb24-11c938aff99mr1264727c88.43.1763655813163; Thu, 20 Nov 2025 08:23:33 -0800 (PST) Received: from phoenix.lan (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11c93e3e945sm12096427c88.6.2025.11.20.08.23.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 08:23:32 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org, Bruce Richardson , Byron Marohn , Yipeng Wang , Saikrishna Edupuganti , Christian Maciocco , Pablo de Lara Subject: [PATCH v4 1/4] examples/server_node_efd: fix format overflow Date: Thu, 20 Nov 2025 08:21:59 -0800 Message-ID: <20251120162327.78062-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251120162327.78062-1-stephen@networkplumber.org> References: <20251110182209.104087-1-stephen@networkplumber.org> <20251120162327.78062-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 If format-truncation is enabled, the compiler detects a string overflow since the snprintf() is putting ethernet address and new line in buffer only sized for the address. Since get_rx_queue_name() is used to create a ring name. The buffer should be sized to be a valid ring name. This fixes some format-overflow warnings and also corrects for future errors. In file included from ../examples/server_node_efd/efd_server/main.c:31: In function ‘get_printable_mac_addr’, inlined from ‘do_stats_display’ at ../examples/server_node_efd/efd_server/main.c:136:3: ../lib/net/rte_ether.h:248:36: warning: ‘snprintf’ output truncated before the last format character [-Wformat-truncation=] 248 | #define RTE_ETHER_ADDR_PRT_FMT "%02X:%02X:%02X:%02X:%02X:%02X" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../examples/server_node_efd/efd_server/main.c:86:33: note: in expansion of macro ‘RTE_ETHER_ADDR_PRT_FMT’ 86 | RTE_ETHER_ADDR_PRT_FMT "\n", | ^~~~~~~~~~~~~~~~~~~~~~ ../examples/server_node_efd/efd_server/main.c: In function ‘do_stats_display’: ../examples/server_node_efd/efd_server/main.c:86:59: note: format string is defined here 86 | RTE_ETHER_ADDR_PRT_FMT "\n", | Fixes: 39aad0e88c58 ("examples/flow_distributor: new example to demonstrate EFD") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson --- examples/server_node_efd/efd_server/main.c | 2 +- examples/server_node_efd/shared/common.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/server_node_efd/efd_server/main.c b/examples/server_node_efd/efd_server/main.c index 75ff0ea532..62c3f4a16d 100644 --- a/examples/server_node_efd/efd_server/main.c +++ b/examples/server_node_efd/efd_server/main.c @@ -68,7 +68,7 @@ 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 char addresses[RTE_MAX_ETHPORTS][RTE_ETHER_ADDR_FMT_SIZE + 1]; struct rte_ether_addr mac; int ret; diff --git a/examples/server_node_efd/shared/common.h b/examples/server_node_efd/shared/common.h index e1ab7e62b7..6726e2031e 100644 --- a/examples/server_node_efd/shared/common.h +++ b/examples/server_node_efd/shared/common.h @@ -58,8 +58,9 @@ get_rx_queue_name(unsigned int id) /* * Buffer for return value. Size calculated by %u being replaced * by maximum 3 digits (plus an extra byte for safety) + * Used as ring name, so upper limit is ring name size. */ - static char buffer[sizeof(MP_NODE_RXQ_NAME) + 2]; + static char buffer[RTE_RING_NAMESIZE]; snprintf(buffer, sizeof(buffer), MP_NODE_RXQ_NAME, id); return buffer; -- 2.51.0