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 9C0A64546C; Sat, 15 Jun 2024 13:43:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75686402BB; Sat, 15 Jun 2024 13:43:23 +0200 (CEST) Received: from fhigh1-smtp.messagingengine.com (fhigh1-smtp.messagingengine.com [103.168.172.152]) by mails.dpdk.org (Postfix) with ESMTP id E7F3640269 for ; Sat, 15 Jun 2024 13:43:21 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 619931140191; Sat, 15 Jun 2024 07:43:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 15 Jun 2024 07:43:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1718451801; x=1718538201; bh=8HXCBGJnhO+dLSX9kbdhJlPUm8rkTpE0vsW+c6f35aY=; b= RO1oEKjYfe/20aoQBV6DynT/pZANEMevKRl5OMXgCv9pkDwvrzWpbqXA0PIZ6Ajo q8hIxmoKDcsBSA5fx5ltDoh5j0u7jt6LtAmNIlAov0VgZNWP2lccHRLCdrz2rZIq Tj2887iJzeUsON2Xas62yPAKOsKQYSaCcGv4yttdg/1Gp/SUpkZanq69g18MwB+r rlGZav1YxNCMfgVXeM53XGcDS012mj4gVkjMf+g5kPWw7jKREOX27A/qY7Su4jPG A3VsznYvznnQTTVkKnvJTSWAgYcwQGePP0zXsI1ZArJHbP4s6fo1lAMmYnjaSJtt lSiHBvmsoc1ntii8MspTjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718451801; x= 1718538201; bh=8HXCBGJnhO+dLSX9kbdhJlPUm8rkTpE0vsW+c6f35aY=; b=a t7pDA9urCnGG2iMyHi08ZtBRu9/FlPQ5Fn+YbildrotM9sHKGJWbNG9WYF2pmRl+ 36yRqFtUk3KnjPfqDc8VK4t8e7CW0CXS7a6ZBpOlC3eEKuOzuelyDrFACN24/Nrv V52WmqpkapTT3AfcjfH7khGWtADJqu1OMCPy5M4O2yn6Cad6kKlDBEbnWOMpHTg+ 5KGvLwHYpQP4fPjB7uQBTIAusp43R2KpptjUDeS1CYWRZ9yb3MRbR+ywX9G/ZrgG us2q/5fbb707eK8sUKc69w7dzEe/wwF/5OkYcydQti4n7z1q4l+fE7hgPKPseq0j yB8cXfN1HU3aAzFIu0T2A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvuddggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpefgueekffetheehffefhefghfejkedtteejleeugffhffehledt hfeuheeiuddttdenucffohhmrghinhepfihikhhiphgvughirgdrohhrghdpghhithhhuh gsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 15 Jun 2024 07:43:19 -0400 (EDT) From: Thomas Monjalon To: Stephen Hemminger Cc: "Van Haaren, Harry" , dev@dpdk.org, "Richardson, Bruce" , Jerin Jacob Subject: Re: [PATCH] event: fix warning from useless snprintf Date: Sat, 15 Jun 2024 13:43:16 +0200 Message-ID: <1864322.ucjEoNaZvj@thomas> In-Reply-To: <20240424121059.04fc8b63@hermes.local> References: <20240424034541.134335-1-stephen@networkplumber.org> <20240424121059.04fc8b63@hermes.local> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 24/04/2024 21:10, Stephen Hemminger: > On Wed, 24 Apr 2024 17:12:39 +0000 > "Van Haaren, Harry" wrote: > > From: Stephen Hemminger > > > "Van Haaren, Harry" wrote: > > > > > From: Stephen Hemminger > > > > > > > > > > With Gcc-14, this warning is generated: > > > > > ../drivers/event/sw/sw_evdev.c:263:3: warning: 'snprintf' will always be truncated; > > > > > specified size is 12, but format string expands to at least 13 [-Wformat-truncation] > > > > > 263 | snprintf(buf, sizeof(buf), "sw%d_iq_%d_rob", dev_id, i); > > > > > | ^ > > > > > > > > > > Yet the whole printf to the buf is unnecessary. The type string argument > > > > > has never been implemented, and should just be NULL. Removing the > > > > > unnecessary snprintf, then means IQ_ROB_NAMESIZE can be removed. > > > > > > > > I understand that today the "type" value isn't implemented, but across the DPDK codebase it > > > > seems like others are filling in "type" to be some debug-useful name/string. If it was added > > > > in future it'd be nice to have the ROB/IQ memory identified by name, like the rest of DPDK components. > > > > > > No, don't bother. This is a case of https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it > > > > I agree that YAGNI perhaps applied when designing the APIs, but the "type" parameter is there now... > > Should we add a guidance of "when reworking code, always pass NULL as the type parameter to rte_malloc functions" somewhere in the programmers guide, to align community with this "pass NULL for type" initiative? > > > > > > > > Acked-by: Harry van Haaren > > > > Did look into Mi-Malloc https://github.com/microsoft/mimalloc > it is fast and more complete and good work with huge pages. > The way to handle tagging allocations having the library automatically handle it > based on the place allocation is called from. Having user do it is not that helpful. But today we have rte_malloc. And the type is used in tracing. I think having a meaningful name from the caller is not a bad idea.