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 6693E440E8; Mon, 27 May 2024 19:22:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 265F5402D9; Mon, 27 May 2024 19:22:01 +0200 (CEST) Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by mails.dpdk.org (Postfix) with ESMTP id B5CAE402D8 for ; Mon, 27 May 2024 19:21:59 +0200 (CEST) Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-43fab2fa4ccso8181cf.2 for ; Mon, 27 May 2024 10:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716830519; x=1717435319; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ESGrhDTw8vivSYxTh6kBcaVHC665SpEDfW0XlG2c8lw=; b=bWqOj3kxeleIkFuh7BjDJ8uiqmQ9ZHKedxWYw/OKtekwhuGXfbGNV1qM4+rMAc3VA+ 4q/HgOHaeqlZy0Wd6Q262ifkpzpuOpP37F9XZDn1Ye+8+7vMWtA+9TxGNER6AfIacccf i0tdyaxhSR889b8NdhRc0V+kXRo5xL3mK2Xeo8R+r1xUMIC3SPo4TLkIefiJm5dZTjGX jRqD+XpmHBsWcbeq3Ba1CNXltDUdb4pYdv3o6+1uRkbqasAQ+RmhaTEzBisMDduNuuHW xyf5XJ9LkxlIO170KBrCmTjVKytlqxbfnsljbzPlmq+1m5pnhHJbw43YntK0KjtUcSSi uC/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716830519; x=1717435319; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ESGrhDTw8vivSYxTh6kBcaVHC665SpEDfW0XlG2c8lw=; b=UiZaYuO82C70qVUt36Hu2e9xouEqnq1XaO1Fe3DyPyl6c2JsrNcAZvmCOqvBHR/Hkp bMYSXCIgck1PZ5ylQR0K3d237rXxOac4TtFhjkKU9Utr+7Iqwqh+BRUKWA9gO5fTkiX4 Ch7bbkDn8Sx9qAK50gdlPzvPeqHapJia1vn2ctZXsG4SAGPoi5cKAQ4lMo8foztg1T/G VNAlDpsbd1ldo3yruJ7RlHsoHwM+5eF0k2eZNtrP+a1qYBEcjjhDWknZyL+wLrfF8qTc tRJbPpJpNA/02nk9FIybzBFqmSdf81ST5ynErMytxxcnvyOmD3jrFCwHybzLvWx4SM38 mqYg== X-Forwarded-Encrypted: i=1; AJvYcCUNUHgp/3oWbGooON/v6qt2mIm5YMojzc9CfxItzCnfPYhn88GInXkq4EMHL4Q3pnbKx6F30CB1n1f9PMo= X-Gm-Message-State: AOJu0YysYPn5qOhd5Mzj/+VMlhCCr2OHCKoyXQ8KuHC1iR6jK16AZtre zmfEjwFHQjFLS79gXwJuc8Ul9m4342wj1LUSynBIr/PO7IvLyrUpqaSvaFK2RsCmxAa6saZYw89 tTnyphc244DxuXFgBfnq35wV8Jh8= X-Google-Smtp-Source: AGHT+IGSIZCBe1yWrSHtBzbmaoYNo9kBnhgUCTjNzHukRmKmDgxlgUn1lc0ndPkKfdgVWZ/xiu/csUck0Mwsb45IlVI= X-Received: by 2002:a05:622a:3ce:b0:43e:26ab:4fbc with SMTP id d75a77b69052e-43fb0f09f36mr121796891cf.48.1716830519063; Mon, 27 May 2024 10:21:59 -0700 (PDT) MIME-Version: 1.0 References: <20240424034541.134335-1-stephen@networkplumber.org> <20240424091352.0eb5d141@hermes.local> <20240424121059.04fc8b63@hermes.local> In-Reply-To: <20240424121059.04fc8b63@hermes.local> From: Jerin Jacob Date: Mon, 27 May 2024 22:51:33 +0530 Message-ID: Subject: Re: [PATCH] event: fix warning from useless snprintf To: Stephen Hemminger Cc: "Van Haaren, Harry" , "dev@dpdk.org" , "Richardson, Bruce" , Jerin Jacob Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Thu, Apr 25, 2024 at 12:41=E2=80=AFAM Stephen Hemminger wrote: > > 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; Jeri= n 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 al= ways be truncated; > > > > > specified size is 12, but format string expands to at least 1= 3 [-Wformat-truncation] > > > > > 263 | snprintf(buf, sizeof(buf), "sw%d_iq_%d_ro= b", dev_id, i); > > > > > | ^ > > > > > > > > > > Yet the whole printf to the buf is unnecessary. The type string a= rgument > > > > > has never been implemented, and should just be NULL. Removing th= e > > > > > unnecessary snprintf, then means IQ_ROB_NAMESIZE can be removed. > > > > > > > > I understand that today the "type" value isn't implemented, but acr= oss the DPDK codebase it > > > > seems like others are filling in "type" to be some debug-useful nam= e/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 "ty= pe" parameter is there now... > > Should we add a guidance of "when reworking code, always pass NULL as t= he type parameter to rte_malloc functions" somewhere in the programmers gui= de, to align community with this "pass NULL for type" initiative? > > > > > > > > Acked-by: Harry van Haaren Changed to event/sw: Applied to dpdk-next-eventdev/for-main. Thanks > >