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 E4A1043EF9; Wed, 24 Apr 2024 21:11:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CEEDA40691; Wed, 24 Apr 2024 21:11:05 +0200 (CEST) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mails.dpdk.org (Postfix) with ESMTP id 0CE7A40689 for ; Wed, 24 Apr 2024 21:11:05 +0200 (CEST) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1e3ca4fe4cfso1366905ad.2 for ; Wed, 24 Apr 2024 12:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1713985864; x=1714590664; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=0IAv8/iOMD+k9gGBSyThgzxD7xIHvbfJmJsVjVyvPM4=; b=ssS7EwLd8qTOkpZ2EKmD7Qxih/M7+DqojQsbFk20wMcGxZdkwuCCci0PnMuUmTfot0 UBzMQw4Y4ut6WCKBWFI+dStEYrPtwWuvqNT5V6YWGghU5kk9MiKuTyoY6lTZG3hWbLM8 zkeDfUus3WOadT0Pz9i+a0jgI8G9DpUc9TTk8Z+Cbr5awv0Z98qUHZnwu1b2QRLZgxHT a4dYnYs4OKGr1HsAr7butb+RSFdK5GADdFUN26SVDTtNHDQ0abdxfzyzDl+hZOEsW7lJ V4dWpwYmISj7ZPS2RDcSp9DW+DL/uQQzg1wpsjEmWStDhoaLwqLGrt8P07FfdMNER3LM 9hDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713985864; x=1714590664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0IAv8/iOMD+k9gGBSyThgzxD7xIHvbfJmJsVjVyvPM4=; b=hgheWbEaGd7rX7GyOeEomex5yuWasNKgzWTyMraMl0VDRWnHC1B2nPowK0h49WZTMz 9cqkxdvdvJSiMtuepUGHjkFHhj95Hg7rJZgAWqQ+8Mkgbnfekb7CAFE+YujZomZIUdAR qF7crVwk9PIuD/06krlrHtXl8dxl7//sRtN7TvCawjhMCsodviO77dFZDsSgDplDllhI A/+i9OTNnEMvfbjvDB4BrLzG83emXvIuvKdiEf0nUOrJ4TTmeQGt+0f6UBA0MIRF1psE lZPshBJrRD2z0rJf89VZxaSjyD1oaW9azApAF7OxybSEmzrNcYmQlY1yvCNwjVt2xx7k LtKQ== X-Gm-Message-State: AOJu0YwfnspyUjfKqMwwSxvtwCKEKJUVT9HTcg/o96I37pj4pbR9ROMN 5lLZpVfAxVlLzyKsz5Q6Yod5o9Jd67ZQkfyhD71HR4D0+m6/KFncdQ2+uSkWS7E= X-Google-Smtp-Source: AGHT+IGpquM4y8PSZtcuFD/w/ob0bL/8satU5GXmNnu6M0hCtoGWpN8Rijp3BogQtQRBEYdcu2cDrQ== X-Received: by 2002:a17:903:18e:b0:1dc:cf38:3a77 with SMTP id z14-20020a170903018e00b001dccf383a77mr3929387plg.55.1713985864157; Wed, 24 Apr 2024 12:11:04 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id a8-20020a170902ecc800b001e944fc9248sm8054532plh.194.2024.04.24.12.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 12:11:04 -0700 (PDT) Date: Wed, 24 Apr 2024 12:10:59 -0700 From: Stephen Hemminger To: "Van Haaren, Harry" Cc: "dev@dpdk.org" , "Richardson, Bruce" , Jerin Jacob Subject: Re: [PATCH] event: fix warning from useless snprintf Message-ID: <20240424121059.04fc8b63@hermes.local> In-Reply-To: References: <20240424034541.134335-1-stephen@networkplumber.org> <20240424091352.0eb5d141@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Wed, 24 Apr 2024 17:12:39 +0000 "Van Haaren, Harry" wrote: > > ________________________________________ > > From: Stephen Hemminger > > Sent: Wednesday, April 24, 2024 5:13 PM > > To: Van Haaren, Harry > > Cc: dev@dpdk.org; Richardson, Bruce; Jerin Jacob > > Subject: Re: [PATCH] event: fix warning from useless snprintf > > > > On Wed, 24 Apr 2024 08:45:52 +0000 > > "Van Haaren, Harry" wrote: > > > > > > From: Stephen Hemminger > > > > Sent: Wednesday, April 24, 2024 4:45 AM > > > > To: dev@dpdk.org > > > > Cc: Richardson, Bruce; Stephen Hemminger; Van Haaren, Harry; Jerin Jacob > > > > Subject: [PATCH] event: fix warning from useless snprintf > > > > > > > > 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.