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 9965942414 for ; Thu, 19 Jan 2023 09:59:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75EEF410DD; Thu, 19 Jan 2023 09:59:59 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id CD5864068E; Thu, 19 Jan 2023 09:59:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674118797; x=1705654797; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=J+lQ/5pWFeqdCCO4Yw7EWoc7lY/jjik9025kVfazBic=; b=N4PZ33jy7DJ/X2/UNIX7/hV/CeUBCVYuhMvykGRsQmAjidT7a0R9tMLP JVLWrG7jjyXqhS5hz1jvUdFPCqbUFIvaWo4Qwc/LmRfdCQrK2sTArjL23 SYslEZvzDzeCpu9ZWu1+ueUFpHoIvXdo1U2pTk4Izq/IFg1xj3ULWGoWO 1VMpnsAEiDMl4OHrE1WYbeQXFb4ivXg8+ekri5WotqLFAP0nAhyyncvOb NfcBzSWF5YZcMqTLXsBcqAN/Y+e2NYZlhDXbt68o2TVWhvmaZRsa+7E9Q ZkFoQ4wefwz7dfl2bDYrOlpJ6ZzkUJn1ijYH6JOSUSd7mGUBsByyS+tVl Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10594"; a="323919344" X-IronPort-AV: E=Sophos;i="5.97,228,1669104000"; d="scan'208";a="323919344" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2023 00:59:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10594"; a="748835665" X-IronPort-AV: E=Sophos;i="5.97,228,1669104000"; d="scan'208";a="748835665" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by FMSMGA003.fm.intel.com with ESMTP; 19 Jan 2023 00:59:48 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 19 Jan 2023 00:59:21 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Thu, 19 Jan 2023 00:59:21 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Thu, 19 Jan 2023 00:59:18 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ozzf513pj4uwzL9ypSWp2qc+tuv2VAUONrU6wwfMrMcuN2O1XwKr0FTNC4GRdkDxflVUgDuDefSw+0An6IXJepTt01UNyeA60mx3mmtNAHDtERm1LdfFpMarcZYccJGNjfAkOru1rIfAk7l3XtKVnlAAptLamBJKbWKN3fMcVdAlGdT4lERlZ6unugf9BRGFO4WLAasMuA8z0+Lnm7z1CD14691pjpQqKOtHhKvrL/ArurRtsvB7tUQ8e3bWs3Iw2u7su0GLj/qp4RMDnLCh+cB36vLZENlUMN1+3TwZ1/m4R8CB+t8tRq+CraUeg5yAhMpck0if+tm9QZcugQUo2Q== 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=VxHWqhww8gfSsTCnAi+CDnC2u+kFaDWVRWPptRzpyj8=; b=DHI7Qu4J/WZ+dUgi8h5XZjuEluu4CTYOpRy7Q/nvB349Ejg+G53AjzVqb0kV9qX8fkkL9/3/p1SqjX7+9LOffPxpxXeQuVrlsJRVXBP9ik6ChLV9A+hr2saB3QtWxQCnCoYFkuNSUVXXoqCnx+VZbvo3hZaBbE+fziar7E16NtulwqSh91WZwURG48cFWGZU1+xT5ezuu5z7SL8pBulLT3vU5cuJx0jy5cpSgxPz9lY5+AvWTPv5NafZeF9h/MU2VTEMGl5rwdr8EepBJXtfeN2P443K8nCvoP1pv4JW7nR8vOGqRIrF5vcYQaprKgz4pyibP+KheCWbPHrA02IcdA== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by CO1PR11MB4850.namprd11.prod.outlook.com (2603:10b6:303:9c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.25; Thu, 19 Jan 2023 08:59:16 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee%7]) with mapi id 15.20.5986.023; Thu, 19 Jan 2023 08:59:16 +0000 Date: Thu, 19 Jan 2023 08:59:10 +0000 From: Bruce Richardson To: Ferruh Yigit CC: , Olivier Matz , Subject: Re: [PATCH] examples/cmdline: fix build error with gcc 12 Message-ID: References: <20230118161111.11710-1-bruce.richardson@intel.com> <3dbc9f6b-9efe-5855-aa8c-37513d823db3@amd.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <3dbc9f6b-9efe-5855-aa8c-37513d823db3@amd.com> X-ClientProxiedBy: LO2P265CA0490.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::15) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CO1PR11MB4850:EE_ X-MS-Office365-Filtering-Correlation-Id: 693f5478-7d6f-4bc3-532a-08daf9fb7153 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WyF0gHtbrPcaJpOs96vsmYm7TyUHlfLndHzUbsVMM4BVHSO2J68mOBzJu5JTQIfCtpfzI6RmEqmf/IEbD3o24qL2HYATBqqExRI8NQ4RLnZ0UZnST9n26ovl4c9txYMcUunJuEc71LMrV2i9QhenR9GJKOWKyE7wL+YqKGMfE8DDsf5vrAJHRpYLp6a5zuswhpvBtYN4eJnGrHJvF70oI+wx7AV6io0SzFYjuUanN0v+AVDnktStnA5GoyJDyswEAdniTeJLcddzqbtxPhmKBFKKXF14oFy4OaOxU8JivZsChjjD8QYNIW7eMWdPh1x98D9X1mmm2x+JALCvkbADjLUGLPnuWuvSE2nf8baxS/uYljBgvs9S46KOmWk30tOIthOTwUvVCThNSMAnRwWDxr3ZHDpznOJtIB5fkVBa3yBXWXYr1qz+KHIswWqLh4lIjctIKIOPDtqVm0FoTYNpCrKZFeMs9qah/lHWHNOGEhFssbr1GNRPjbo54IAdXVmJUPvWazw9K8OoixbfKqmJqDUhfd44wtY4dtISukpg0HUA49vTYbYCNqrq4kD6QNzMgo7mm1hEgZBBIe3gZYtDA8tyf9feYaurY0VwinYKmrr2jtsDOaVXdp7P3P/XM56kUrAYK/c8O/eaThFj76R+Cg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(366004)(136003)(39860400002)(346002)(396003)(451199015)(8936002)(316002)(5660300002)(86362001)(6486002)(478600001)(6666004)(53546011)(6506007)(2906002)(44832011)(83380400001)(38100700002)(66556008)(66946007)(4326008)(6916009)(8676002)(66476007)(82960400001)(186003)(6512007)(26005)(41300700001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7SvDwstPATGCeuhM2rtuiuxQfJhTF8B61Y9Cy+ofnuzTTH9sJ1T5N63bO5rg?= =?us-ascii?Q?vu0OwPeMOLtnSgSrwZ3VqNEoGkFJyY4nqiQodvtKbGPpfNnnpGmBiZrnT5XC?= =?us-ascii?Q?rRSYVRI6BX8hlr4YYRBpEyw1/PavJYTVv6bcP30xMIqKriIAE7LfUcgRvGLs?= =?us-ascii?Q?G/8dtec0A+6+/BSil9mhuZzY4omdFedAyWmvS7Tcngw0qE8JPiHbUX8fGCzC?= =?us-ascii?Q?dvf8dmAIUBLnsKTAsJtDiPnFuhSWJVBe6QiccNYxizD1XyqvE8Nr7q+rwlUV?= =?us-ascii?Q?EOsVDyyw0osnHrvnKti5qLR5A941L3dF1CMKw5wcBKhaK/T84dnoFzOLkRGT?= =?us-ascii?Q?iOxf3iJljkhG9uuqYgS4Kqsv0tsqTSmbm+HiuV0sv0gFeqEAM26iNN7aiRUJ?= =?us-ascii?Q?n+MeJWFD6OGlmfzCVu2khLcNM7cFk2paRfMXzUkpimo5Qy7MTBPofq6WI76Q?= =?us-ascii?Q?OEdw/uOPprkVsKZDUWf9rcpJQm0KlxpuWi10+raES1VWrnwItc2Dz7ew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YEp3cAB5LkQgAfQ9Xqyko3O2bnlfQVgqa?= =?us-ascii?Q?3y/bqXAE/kxioE7fcyo8Jqi1Geh7usxpCuRXQMoUrhU0OYADAeQTESTFICu+?= =?us-ascii?Q?jAsoF9jSAUYg6hvV4aQVb3vKHVr/X4tTohnOXqLGjSY6vEuaCFa44EBQOw27?= =?us-ascii?Q?4+HuJyYUYNrMQ9IWgTB9h1w4lGR+pF+BgxjaI2i5JK5FB0ipvS7fYC6zdi5B?= =?us-ascii?Q?3g=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 693f5478-7d6f-4bc3-532a-08daf9fb7153 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 08:59:16.3178 (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: 2ceUsEvrLH9uWdcmYSVKMcsmOolxWX0OyEopCswISkpJopuR4kTetnF9c9DUba0AveiARZk+oscCN0txVxs5k3HxMzdmReQiLQHyCUQnCpM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4850 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Wed, Jan 18, 2023 at 06:53:33PM +0000, Ferruh Yigit wrote: > On 1/18/2023 4:11 PM, Bruce Richardson wrote: > > When building the example without libbsd and using the DPDK-provided > > strlcpy function, a compiler warning is emitted by GCC 12 about the copy > > of the parsed string into the resulting object. This is because the > > source from cmdline library is 128 bytes and the destination buffer is > > 64-bytes. > > > > commands.c: In function 'cmd_obj_add_parsed': > > .../__BUILDS/build-x86-generic/install/usr/local/include/rte_string_fns.h:61:24: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 64 [-Wformat-truncation=] > > 61 | return (size_t)snprintf(dst, size, "%s", src); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > In file included from /usr/include/stdio.h:894, > > from commands.c:7: > > /usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: '__builtin_snprintf' output between 1 and 128 bytes into a destination of size 64 > > > > Multiple options are possible to fix this, but the one taken in this > > patch is to ensure truncation never occurs by setting the destination > > buffer size to be the same as that used by the cmdline library. > > > > Fixes: af75078fece3 ("first public release") > > Cc: stable@dpdk.org > > > > Signed-off-by: Bruce Richardson > > --- > > examples/cmdline/parse_obj_list.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/examples/cmdline/parse_obj_list.h b/examples/cmdline/parse_obj_list.h > > index 6516d3e2c2..1223ac1e8b 100644 > > --- a/examples/cmdline/parse_obj_list.h > > +++ b/examples/cmdline/parse_obj_list.h > > @@ -12,8 +12,9 @@ > > > > #include > > #include > > +#include > > > > -#define OBJ_NAME_LEN_MAX 64 > > +#define OBJ_NAME_LEN_MAX sizeof(cmdline_fixed_string_t) > > > > struct object { > > SLIST_ENTRY(object) next; > > I confirm it solves the build warning, but what about to get rid of > `OBJ_NAME_LEN_MAX` completely if the intentions is to make size same as > cmdline library array: > Sure. Another potential fix is just to cast-away [(void)] the return value from strlcpy and allow truncation. Olivier, as maintainer, what is your preferred fix here? /Bruce