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 54F3943EF6; Wed, 24 Apr 2024 10:45:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCE0B433D5; Wed, 24 Apr 2024 10:45:58 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mails.dpdk.org (Postfix) with ESMTP id 024BE433C0 for ; Wed, 24 Apr 2024 10:45:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713948357; x=1745484357; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=+vkBQvtORLl3EwMJn550OYomdVWD7VU7PQAaxfCiXbI=; b=i3S5wM2UEjeMb4DUMwW/a3x3B15KWFyylNaAI8URvjRS+nvkRsPeg/dG a1EPPOa+fxNt2tj9Vxu+zIk1ApLg5x4zrTMEQz/ixBM3dsaY9zQDFe+yA FX68IX3HqhoLJhzFwr0ZL/uqE6xamROwQ99Bi6aSnkZsNvndTAlfSr90h 6+KAzByqDnbIlDxqdDoN8YyFhq8xMTKzJ2z3Ci6ynQm6F2k+lcNTAnpfC 4Y2fRs6RUlJjfstZrVmmHeQNRMZOoTmVdS5jQh0pi68/GmXXE7BS0xyfo yQAD4ZHwcLlNMfUlUSQCpUPDrskLLGzA73PZEshalwot8VMO7mGPSGnvc w==; X-CSE-ConnectionGUID: QoRK5IhcTLeT59MzqwGDIw== X-CSE-MsgGUID: Al5whhvsSDedDVn5WCb9dQ== X-IronPort-AV: E=McAfee;i="6600,9927,11053"; a="13400096" X-IronPort-AV: E=Sophos;i="6.07,225,1708416000"; d="scan'208";a="13400096" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2024 01:45:55 -0700 X-CSE-ConnectionGUID: Gd88MOQURG6RxIq6gPQ53w== X-CSE-MsgGUID: fPIdv33ITFW9Jlwe3LuZqA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,225,1708416000"; d="scan'208";a="24697598" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa010.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 Apr 2024 01:45:55 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 24 Apr 2024 01:45:54 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 24 Apr 2024 01:45:54 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 24 Apr 2024 01:45:54 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 24 Apr 2024 01:45:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LNZu24tLifKTzmpCz4+KfYNAWnFQHFa2aI3yklnYluIGh9BJ60ztHJVoUjHSnkz1znTIAPVBLzuuj1VJ8cNMna7a4g3Gx4F7K7ODjmD4gUgnnTXiTQtsO6grYNU557sOuJdXp5+e82kRgKa0xMunPLrlidEYXFx47CX7eaIfY3ei4iAXWabmnv8/MPZDWgqYSgUtcQyanV6wYSCkC950iMG5Bj9Y0qLPRqHJhds1GmUVhKqZWfz3paZa6374Kj7XXrHRGpp8or0VlT58vseE8gZ0eRbEv2Jwdh28Limrs+G3fk52s8Qsj/WFSZGv1iRYzUN7jTHBGGGVYrHBUMzpEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dpZL4coqlsla2Rs8/bgG4hINM0nQZ5AydmRdDwxkJC4=; b=kmkNZ/dpQ9ZesgT/Abb34MzdTTHOSIPyL+BqDBmXycLfdwEri8JtNeJevL3/5hu23EbyC6EdxiSW8/dIo4IKtJfJcGvcRv+ZAdFmm/qwSJsy5qNA+oBl2MK4NB9ZEURl52C+3ryEeREJGS7/PRCpMCCBjS7WD+MOfDiFnIuBBu9kut5RTRCUNdJJfS1PUTrbiYL2Nh3KWcCFF1FgkoR2itaJXXFrwtj2VLYKIbNpIBaLsmLMjxEPflYgNJ1R/LPV+jYcoc0pbOXV4AiW8xPJkF1y6x0ownaZpKGHh6lbXB9X1QNw8bVpz/Ds95BC5Z1+tJTMGMcbga3ZEdfK7XhDYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH8PR11MB6803.namprd11.prod.outlook.com (2603:10b6:510:1cb::12) by IA1PR11MB7270.namprd11.prod.outlook.com (2603:10b6:208:42a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.20; Wed, 24 Apr 2024 08:45:52 +0000 Received: from PH8PR11MB6803.namprd11.prod.outlook.com ([fe80::8680:ff9f:997:18b4]) by PH8PR11MB6803.namprd11.prod.outlook.com ([fe80::8680:ff9f:997:18b4%4]) with mapi id 15.20.7519.020; Wed, 24 Apr 2024 08:45:52 +0000 From: "Van Haaren, Harry" To: Stephen Hemminger , "dev@dpdk.org" CC: "Richardson, Bruce" , Jerin Jacob Subject: Re: [PATCH] event: fix warning from useless snprintf Thread-Topic: [PATCH] event: fix warning from useless snprintf Thread-Index: AQHalfnu0YkCa4sPI0ejm9ckWpMHS7F3GRtb Date: Wed, 24 Apr 2024 08:45:52 +0000 Message-ID: References: <20240424034541.134335-1-stephen@networkplumber.org> In-Reply-To: <20240424034541.134335-1-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH8PR11MB6803:EE_|IA1PR11MB7270:EE_ x-ms-office365-filtering-correlation-id: 3a760d11-37d6-4b79-8a88-08dc643af298 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|1800799015|376005|366007|38070700009; x-microsoft-antispam-message-info: =?iso-8859-1?Q?qOfm/vS7mJYFgydXvbTQcImu1bCL+ZzhhagwSENkUYvfVWJXOfDLUyUqvq?= =?iso-8859-1?Q?pxcUB/Tz+4PBqBKmOhLreTlew3S7k6IVhI5eCDDONs+/L+DCBFmwFuZBRT?= =?iso-8859-1?Q?WTcjWhA2yJWm2MrPnMeaQ8dUXC1EKGyU3IYRjf56LbV93rkwfVOFIooO46?= =?iso-8859-1?Q?B5rspTlzUv4Phl0rjirDaVCa9lA1TKT+grXixZJVRD8dTID/uIRX0bofdu?= =?iso-8859-1?Q?si0+QrOMLeioGJnOF0Io5RZugvvT1H9vuePQsoLVby85GjW60OL0DvvGuU?= =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0xltGJkTcvFGtLnB+5H8IN6c?= =?iso-8859-1?Q?mM77CVHFghH9b/2Rslpsw+j279UjMs2pjQAopwOZ38dv0nZHkCUEX5gen8?= =?iso-8859-1?Q?oMgMYrXmNeLv5NKqxY0U0WPAniptSA2huMfHHTo8MvFHNqM9Wfrz84eN3w?= =?iso-8859-1?Q?gW7iry+RwaypH3dnswD9SevrMJKyPgeo+ZCcSfay8c5rU1feKc5E0Lsysq?= =?iso-8859-1?Q?QATrTnC2IMYChpj+CXSWVHlmTuLZ/WDw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH8PR11MB6803.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005)(366007)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?zZ09cLC+LORQMjeXllGzipMU17tkNQFi1yevwjcsmkWfy11FhyZLFXnNYq?= =?iso-8859-1?Q?DsUmq3Pd9crAntIzr7x/Qq2ashSjzB4jOXRbYikT8UJOvABCAIgT+W97Pf?= =?iso-8859-1?Q?8Owslmy7+3G45nhCXjoeH3jz5mhNjBvDqDzuEaWF+tuo7ozh1rh0Q+aCCg?= =?iso-8859-1?Q?Pc4mTplOglYv5vQCR/o2mI+au30UxkDd8tXJGRYXMD99q0joprRg6doE4T?= =?iso-8859-1?Q?cn4zimBLJ5xYAmIXvotv+vj7XJBW20jpoPmLolmsm3UoyQDfTZkLVzXr/x?= =?iso-8859-1?Q?C8W/DlnrjdPeAoLab5G2/5VDAF8gRe+hSsyoh1u4xO2P4Lz4TgpRgeiTUh?= =?iso-8859-1?Q?JeygKizxbSdPPMES7qgUDox9AoqcH8Dqw286GbDdkJZklojxHNEUdNaost?= =?iso-8859-1?Q?myd0Ax9fjwlKPLnLEuEqpco5gYubOygkMkjzwzcFsuSh8x0LmDFXrl0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2tkwPVgxZKxApRmflPBH7RciFFuwhK8?= =?iso-8859-1?Q?h1keOAg4crlKfDCYT6bJdMtwckgvs/5MoODl2eS5iVr0yJRL/Mkyo+F1vY?= =?iso-8859-1?Q?OdXK33ZcR1ykD1cZEUXCk6DDjbS5HEaXeNvQEFC7EMTQAetMoDo9JzV7YJ?= =?iso-8859-1?Q?UGoFcBhU3GxUP4UbJnRuNrBXv+JsZCbXE4LYQwmREJtAwN2XnLeDvrfbep?= =?iso-8859-1?Q?GtWb3oiM3Eh+Qf+ssQRle7LSe0y+rEun8xE0LP26c4nreb3J5cHxxF2gmL?= =?iso-8859-1?Q?2ZUh3Qlk/67yD2FUDCx5IdaGrLuQCC23tvORwgXPttfG67wzXZAv1FgA?= =?iso-8859-1?Q?=3D=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH8PR11MB6803.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a760d11-37d6-4b79-8a88-08dc643af298 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Apr 2024 08:45:52.0387 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XbvcLw3JO7v3Hv+QXMBPeHkbbt0LOBR8RBRlCAzFxNSQDBCqSEllArkfOs3IaQYTlYu1p11rKJMUKS3hL6lQR547eWcKSYeOR1XA8mwbGOg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7270 X-OriginatorOrg: intel.com 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 > From: Stephen Hemminger =0A= > Sent: Wednesday, April 24, 2024 4:45 AM=0A= > To: dev@dpdk.org=0A= > Cc: Richardson, Bruce; Stephen Hemminger; Van Haaren, Harry; Jerin Jacob= =0A= > Subject: [PATCH] event: fix warning from useless snprintf=0A= > =0A= > With Gcc-14, this warning is generated:=0A= > ../drivers/event/sw/sw_evdev.c:263:3: warning: 'snprintf' will always be = truncated;=0A= > specified size is 12, but format string expands to at least 13 [-Wfor= mat-truncation]=0A= > 263 | snprintf(buf, sizeof(buf), "sw%d_iq_%d_rob", dev_= id, i);=0A= > | ^=0A= > =0A= > Yet the whole printf to the buf is unnecessary. The type string argument= =0A= > has never been implemented, and should just be NULL. Removing the=0A= > unnecessary snprintf, then means IQ_ROB_NAMESIZE can be removed.=0A= =0A= I understand that today the "type" value isn't implemented, but across the = DPDK codebase it=0A= seems like others are filling in "type" to be some debug-useful name/string= . If it was added=0A= in future it'd be nice to have the ROB/IQ memory identified by name, like t= he rest of DPDK components.=0A= =0A= =0A= > Fixes: 5ffb2f142d95 ("event/sw: support event queues")=0A= > =0A= > Signed-off-by: Stephen Hemminger =0A= > ---=0A= > drivers/event/sw/iq_chunk.h | 2 --=0A= > drivers/event/sw/sw_evdev.c | 5 +----=0A= > 2 files changed, 1 insertion(+), 6 deletions(-)=0A= > =0A= > diff --git a/drivers/event/sw/iq_chunk.h b/drivers/event/sw/iq_chunk.h=0A= > index 7a7a8782e6..e638142dbc 100644=0A= > --- a/drivers/event/sw/iq_chunk.h=0A= > +++ b/drivers/event/sw/iq_chunk.h=0A= > @@ -9,8 +9,6 @@=0A= > #include =0A= > #include =0A= > =0A= > -#define IQ_ROB_NAMESIZE 12=0A= =0A= We can over-provision the temporary buffer, and solve the problem with mini= mal changes;=0A= +#define IQ_ROB_NAMESIZE 64=0A= =0A= > -=0A= > struct __rte_cache_aligned sw_queue_chunk {=0A= > struct rte_event events[SW_EVS_PER_Q_CHUNK];=0A= > struct sw_queue_chunk *next;=0A= > diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c=0A= > index 1c01b069fe..19a52afc7d 100644=0A= > --- a/drivers/event/sw/sw_evdev.c=0A= > +++ b/drivers/event/sw/sw_evdev.c=0A= > @@ -228,9 +228,7 @@ qid_init(struct sw_evdev *sw, unsigned int idx, int t= ype,=0A= > const struct rte_event_queue_conf *queue_conf)=0A= > {=0A= > unsigned int i;=0A= > - int dev_id =3D sw->data->dev_id;=0A= > int socket_id =3D sw->data->socket_id;=0A= > - char buf[IQ_ROB_NAMESIZE];=0A= > struct sw_qid *qid =3D &sw->qids[idx];=0A= > =0A= > /* Initialize the FID structures to no pinning (-1), and zero pac= kets */=0A= > @@ -260,8 +258,7 @@ qid_init(struct sw_evdev *sw, unsigned int idx, int t= ype,=0A= > goto cleanup;=0A= > }=0A= > =0A= > - snprintf(buf, sizeof(buf), "sw%d_iq_%d_rob", dev_id, i);= =0A= =0A= There is a 2nd hidden bug here; the "i" variable iterates the ROB size, and= does not represent the QID index.=0A= Changing the "i" to "idx" solves, and prints the expected output instead:= =0A= snprintf(buf, sizeof(buf), "sw%d_iq_%d_rob", dev_id, idx);=0A= =0A= > - qid->reorder_buffer =3D rte_zmalloc_socket(buf,=0A= > + qid->reorder_buffer =3D rte_zmalloc_socket(NULL,=0A= > window_size * sizeof(qid->reorder_buffer[= 0]),=0A= > 0, socket_id);=0A= > if (!qid->reorder_buffer) {=0A= > --=0A= > 2.43.0=0A= =0A= I'm happy to send a patch with the above, if that seems a good solution to = you Stephen?=0A= =0A= Regards, -Harry=