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 8DCBB4705A for ; Tue, 16 Dec 2025 17:12:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8937F402EA; Tue, 16 Dec 2025 17:12:43 +0100 (CET) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by mails.dpdk.org (Postfix) with ESMTP id 2F6834026D for ; Tue, 16 Dec 2025 17:12:34 +0100 (CET) Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-8804f1bd6a7so47138486d6.2 for ; Tue, 16 Dec 2025 08:12:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytheb-org.20230601.gappssmtp.com; s=20230601; t=1765901553; x=1766506353; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=c9udCnPqQQSu/sWH0B8S4FGJyyZw8mv/0s7zbYvm4oo=; b=EP4dWWJ5vG/qLevQptRsJV5NJtQ+ybzen+G9JKtSsW2WRlJI6Qm1Pq6qkTYEDi/k4O CY0alwdWg1wQVwBc6kNy0OKmSLTt4IO2wYntWwF5Zc5zlH8qcI/mOPbWzcefDTOjL2ZV hOacjdcftlusMUMgYegowzMuWSVOf2qCFmaw3eIndtaihvgBZOdnVwYpalsa41xTojcp 0Mtg+Iq/u4UtSfw/LTL6VtcLwYHUJtcv2cK121fmGRmhSHbReKk3KpEMLVb4uBtSDU6k yjWDpLjTYH+M5Ahu5Gd06PrakFFY5q+N6POtnG3kfEAvVxcS85gS5LWDbmN1W0iQjH+P PCAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765901553; x=1766506353; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=c9udCnPqQQSu/sWH0B8S4FGJyyZw8mv/0s7zbYvm4oo=; b=nRnUWDm33Zj/HFcBKrg26WlHOH8Bv5O+w1AcOxsjnaAPLwrnSc+/oEWvLx9aYx3uHu 6Ql96ipdxsl6e56mZE4v26o7xtD9+rldkv6RkGApw8ImwVYjbq9NAX3zhk1bSAjpEMVm VRWdOAi1WjVvotse3OfCVYjqbro5HJ6BsXPSVYAolLvKXFaLrqTKF/sK0tkK22Z/fD6X abWTPZF5H5XT4M2X9Vi+j1L+Otf9gquCigRSWGibL5ayPGUoXG7+RnaHRw0O7TnP4t9g rp2BRGDM/ytAqYvAwBOc09KPitid3hcHQUK0rLS32vqAjEPnRuXrOpgc5MATOxYCrezy nbsg== X-Gm-Message-State: AOJu0YysqmCZA0lhPJFLAh7UYfuolasQor1uEE+uoDxrHengvU+VRdS8 bxuyqyYzspsoCp2hGiNSDw7vZxoIrgO9QI88goj6zWf8BItyg4z1MvmFPan0KCUdGOkarAWNdqk MnE1n X-Gm-Gg: AY/fxX7M8MOBkGmDI4Ha70fHlZ5yPW/RK9xMhpvu3krfFsa0t/ragPI0w2HPUv7Sa+R TTAJq4RHEh+RS5os7nkMOs7cq1V7hncu/sox4zRJgqI6GjW0CXwXKQkKMFuABkC04Kft1sQLDyH opNVxgUTjsF16BWKO4rBnN+865rHYVSK5l5MnvaQ3eY3AL8Vgcpr6/Hx3pOW3GYG0ddbt6QT5bT 7ZIpFfyI+mtkC0ozr75D7kSa0I3Ik5nmsYRg3iy1qCSmHMAINCJFwHYQH1wyclUwKhtwgCRCgC/ MYx20nSUTffOZ8kYM0Og/C8suEPwRl/cDEm9F2mXkbFGDBwmsNHo0SWCNWmFvSSuujbu8KBhREr klr5LRsouUBtz35O3bOGobfoBnrl0Zj2PoR0GQlJ0saKSosFBt3INdzFArvVckJ877qTTYWs5cV 7JdEZ9JtmJDcfV2+j5hQ== X-Google-Smtp-Source: AGHT+IFm9tLqBBP3U+b2JJu6dwKB4/b3BHlHua6aXSGHF27VN/wwVhfXAQiJlCXKB+ACCpbBw0f5FQ== X-Received: by 2002:a05:6214:252a:b0:880:4310:7e02 with SMTP id 6a1803df08f44-8887e417badmr238139436d6.21.1765901553171; Tue, 16 Dec 2025 08:12:33 -0800 (PST) Received: from RHTRH0061144.redhat.com ([47.14.5.10]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-88993b62653sm74543186d6.16.2025.12.16.08.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Dec 2025 08:12:32 -0800 (PST) From: 0-day Robot To: test-report@dpdk.org, Stephen Hemminger Subject: |SUCCESS| pw159226 [PATCH v5 15/17] ethdev: avoid possible overflow in xstat names Date: Tue, 16 Dec 2025 11:12:30 -0500 Message-ID: <20251216161230.762636-1-robot@bytheb.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251207191242.165619-16-stephen@networkplumber.org> References: <20251205022948.327743-1-stephen@networkplumber.org> <20251207191242.165619-1-stephen@networkplumber.org> <20251207191242.165619-16-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: test-report@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: automatic DPDK test reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: test-report-bounces@dpdk.org Test-Label: 0day Robot - Claude SONNET Test-Status: SUCCESS http://dpdk.org/patch/159226 _AI Review Comments Available_ **TodoWrite Items:** - [x] git sha of the commit: (from patch series v5 15/17) - [x] Author: Stephen Hemminger - [x] One line subject: ethdev: avoid possible overflow in xstat names - [x] Brief summary of the commit - [x] Unified diff of the commit, quoted as email reply - [x] Questions about regressions placed alongside relevant code - [x] Snipped portions of quoted content unrelated to review - [x] Check every hunk for relevance to review comments - [x] Retain necessary diff headers - [x] Replace snipped content with [ ... ] - [x] Only keep quoted material needed for review to make sense --- Author: Stephen Hemminger Subject: ethdev: avoid possible overflow in xstat names This commit adds overflow checking to snprintf operations when constructing ethernet device statistic names. It replaces silent truncation with explicit error logging when statistic names exceed the available buffer space. > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index c6fe0d5165..05de3335e5 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -3489,9 +3489,10 @@ eth_basic_stats_get_names(struct rte_eth_dev *dev, > uint16_t num_q; > > for (idx = 0; idx < RTE_NB_STATS; idx++) { > - strlcpy(xstats_names[cnt_used_entries].name, > - eth_dev_stats_strings[idx].name, > - sizeof(xstats_names[0].name)); > + if (strlcpy(xstats_names[cnt_used_entries].name, eth_dev_stats_strings[idx].name, > + sizeof(xstats_names[0].name)) >= sizeof(xstats_names[0].name)) > + RTE_ETHDEV_LOG_LINE(ERR, "statistic name '%s' will be truncated", > + xstats_names[cnt_used_entries].name); Does this error message print the correct value? After strlcpy truncates the source string, xstats_names[cnt_used_entries].name contains the truncated version rather than the original problematic string from eth_dev_stats_strings[idx].name. > @@ -3501,10 +3502,17 @@ eth_basic_stats_get_names(struct rte_eth_dev *dev, > num_q = RTE_MIN(dev->data->nb_rx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS); > for (id_queue = 0; id_queue < num_q; id_queue++) { > for (idx = 0; idx < RTE_NB_RXQ_STATS; idx++) { > - snprintf(xstats_names[cnt_used_entries].name, > - sizeof(xstats_names[0].name), > - "rx_q%u_%s", > - id_queue, eth_dev_rxq_stats_strings[idx].name); > + unsigned int cc; > + > + cc = snprintf(xstats_names[cnt_used_entries].name, > + sizeof(xstats_names[0].name), > + "rx_q%u_%s", > + id_queue, eth_dev_rxq_stats_strings[idx].name); > + > + /* could only happen if a long string was added */ > + if (cc >= sizeof(xstats_names[0].name)) > + RTE_ETHDEV_LOG_LINE(ERR, "truncated rxq stat string '%s'", > + eth_dev_rxq_stats_strings[idx].name); Should this error message include the queue ID to help identify which specific queue statistic caused the truncation? The current message only shows the base statistic name without the queue context. > @@ -3512,10 +3520,15 @@ eth_basic_stats_get_names(struct rte_eth_dev *dev, > num_q = RTE_MIN(dev->data->nb_tx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS); > for (id_queue = 0; id_queue < num_q; id_queue++) { > for (idx = 0; idx < RTE_NB_TXQ_STATS; idx++) { > - snprintf(xstats_names[cnt_used_entries].name, > - sizeof(xstats_names[0].name), > - "tx_q%u_%s", > - id_queue, eth_dev_txq_stats_strings[idx].name); > + unsigned int cc; > + > + cc = snprintf(xstats_names[cnt_used_entries].name, > + sizeof(xstats_names[0].name), > + "tx_q%u_%s", > + id_queue, eth_dev_txq_stats_strings[idx].name); > + if (cc >= sizeof(xstats_names[0].name)) > + RTE_ETHDEV_LOG_LINE(ERR, "truncated txq stat string '%s'", > + eth_dev_txq_stats_strings[idx].name); Would it be more consistent to include the same comment about "could only happen if a long string was added" here as in the rx queue handling above?