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 52DDE428AF; Wed, 5 Apr 2023 10:55:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4500F427F2; Wed, 5 Apr 2023 10:55:02 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id E993F41151 for ; Wed, 5 Apr 2023 10:55:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680684901; x=1712220901; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=XBNRCS6JEQrWvo6k1t0FKod4V6J4VpXc2xGGm9vYZHM=; b=fX/RS2ZQYvtjE2oaFI16k1CtPf3HvFIxlqxf4zW1g+XQ6kvrfBsYh00Y lrLoRg+jqNL0x3AsmZfJVajIiyynK5HNU9W2aWSbUDJ2cCthnSKCL/i9J L/IpR0v5fqgiFmQ8C1EW9juHmfIz1wLza5KSplQZTRZ16MwMTtT0g2RYU //ZaGG1Cacm5VMyrvxKqeZurG4mrnAA5TaKx7wUp3IQRyrldPXf0N8N/l 7g1XRQMmlXUciKPX1FhbQyAsNxRXAeQ3qnO9TgeQf/xStDYdaC75nztqT TSb5b+zYsXYdUwbKJldPEhpujxrd7c3YwCEuRUOdL0n/D/5XC1OVNd/Nl w==; X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="342421248" X-IronPort-AV: E=Sophos;i="5.98,319,1673942400"; d="scan'208";a="342421248" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2023 01:55:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="716960680" X-IronPort-AV: E=Sophos;i="5.98,319,1673942400"; d="scan'208";a="716960680" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 05 Apr 2023 01:54:59 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) 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.21; Wed, 5 Apr 2023 01:54:59 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 5 Apr 2023 01:54:59 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.21 via Frontend Transport; Wed, 5 Apr 2023 01:54:59 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.174) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Wed, 5 Apr 2023 01:54:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WVovSe02tfVJIJMrM8kGDqf9QyMgan5PxJlUE1gELDY5Kghm5Dkgo/Buykq0of2IetDVJAtRSgFHAlvBd2aOUwwk6G4Kx2Kk0MZUKeY+g6OnuMWsAA+tzHprBPPCAr5s3rBUj4dLpGxKRVi/zt2JoNeU7bgAE/SjUQYWra1oKtJI9zyfyTFI+jhPcfs31XWoXXhGnk5InQ+RCMjIhlks2EyWP/zsMaRRAKfWaDVmrECqn1UNn4/2hxCPFvcz7TGM85dxsk5vDWy70hXS4YLzUMEco+hYZ7POQH3AtGDjsv1IgHwM555iM/u6nX2dvfzy6ARRpaFzjSmkyyGZj56sTA== 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=hB4ii7JScgbA6t51FjAmpHphdAg+z+aqkWsnvV0jdV8=; b=S09Z5SM8MvrHUDn8YWnJRvraq7kUbJ/ugwPdnza+tBdCJhiTwGRFMMJUn1BHj9iisNb7Txw7iBQ9FzaZY28+oSkcswZqO6UJ5oyFZ9OM5cq/E2zjtxVCY1Cjnf7wZpShCLvvBv4nlDVfQg4eYXQ42dDLA/AJX3nuBIN13UOWJNa+fjQ7UtQfHAD8M7fgc7Y08KCHXq3s2RN1J9mR0hfYcMxygfmo7ZYjXCyhwtygUAz3QzYYNnLUYlSIdfsBswp4oTU27+K14HouyAWnoi0xJ4Aqz7BQRVzpUGuIxLBSV552cjftJNjpPdq6zhjVwpdbuUG7ybYI2nP2Y2GEJ2dq+A== 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 CH0PR11MB5491.namprd11.prod.outlook.com (2603:10b6:610:d6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Wed, 5 Apr 2023 08:54:52 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::18d0:ac53:aa1d:d19c]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::18d0:ac53:aa1d:d19c%6]) with mapi id 15.20.6254.035; Wed, 5 Apr 2023 08:54:52 +0000 Date: Wed, 5 Apr 2023 09:54:46 +0100 From: Bruce Richardson To: Stephen Hemminger CC: Tyler Retzlaff , , , , Subject: Re: [PATCH 1/2] telemetry: use malloc instead of variable length array Message-ID: References: <1680539424-20255-1-git-send-email-roretzla@linux.microsoft.com> <1680539424-20255-2-git-send-email-roretzla@linux.microsoft.com> <20230403131913.0aec54ce@hermes.local> <20230404180432.2dc01862@hermes.local> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230404180432.2dc01862@hermes.local> X-ClientProxiedBy: LO4P123CA0095.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::10) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CH0PR11MB5491:EE_ X-MS-Office365-Filtering-Correlation-Id: fb211586-15e8-41b5-995d-08db35b36b69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zzam7imRirst/KIC6Un9SeyFugbAipPQuVPD+TzYMTyEsEbj7nSUGJvZ5AgEiW7t6s0rnPJmFIxzgd5ssReNAJSajiRStWpnud8lYQBusBOuw4FvciApj2evxTRBKdJbnLG0tfubGrCvoUNPe5Xa/OIkvWVNTGMGs1VwWrR9v8xJFsxur8zRpWoSlOQQnqKuiWQTQbgr3nwVbpmWB27VUxa1QW7/Zi+b097zhg24ZcZsbHfhn1f6lX/VcCS6faKO8VUa0K5YotyLBIAiSIzMPBUHpu9UF2+P7nqz/PyQ1SGWja3CgkrA2vbsEeY2pJ9cDqRqf5gG6mOG+dr7eb9/bl+wbsZn+11WLYnuRbPmWt74nzU8npNRRmjqR5o+z63S6zcxq61JNjhpH9KtTtpDXYXfABsB4hpeDpz/NhNIL/ZanZBvlz6cnblo0tvuHg5x3QTi1+XjKlrKyPt8pEGdwsCosFfdUyZ7lO+sye1+7MW5gnomUWgJ1pj6MKQE3Dmbyyi6POtx9qjIydJZd1M4r4g08MSqZjEC2MasV3QOKHk3fS1tJ1lf1uNSPdHx0hHB 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:(13230028)(396003)(366004)(39860400002)(376002)(346002)(136003)(451199021)(6666004)(186003)(26005)(66946007)(8676002)(6512007)(478600001)(41300700001)(316002)(6506007)(6916009)(4326008)(82960400001)(66476007)(66556008)(6486002)(38100700002)(86362001)(5660300002)(2906002)(4744005)(44832011)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GQeOefz1uCh8otEYIp3d6cSTAnqbxu+1pv5dcAJ4qEZpo4+tma9DoUMGh1wU?= =?us-ascii?Q?kUi6tcUDoQFAK00Soprgo/0Ji3/manghNw+2ou0GH6JUXJRpFgSwgJCRKrtg?= =?us-ascii?Q?2aWRGENOZMBud0M8b6OpdEt0Ztjz8eSX4WPhoClAGuVLvD0HOQQFqldm7ONQ?= =?us-ascii?Q?eg7e1svYYGtHxqynW7MmOf+V29mM3Flz+lBFeogtG1GlY0XtwW6smKE6rDq4?= =?us-ascii?Q?rTSXOtkPHd/s75vG7knrkp3VLuBQhTHhprCZXmyH1mfRs72LtQ/gFCVScj6v?= =?us-ascii?Q?Zgufvuvy0Dmjnx+HMj6B+K7jqfQY2UO16UYJ8TRxP8csr1TV/NfeSYGVylA/?= =?us-ascii?Q?agbQVm4iL9+7NlzjWGaipqmtC92xk4yUJ+ET1POJ9sX5WLAR0vyTmjrfSag1?= =?us-ascii?Q?uzKuPDy2Ijt3I4E8jiiVsKCP7tE4lmWoFbH3onx8gxicAWYTNx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QEmSRjY0c5h87Ani3k3Rt3dGLJRFpEJWj3VZSZiCqD8urLudukmI?= =?us-ascii?Q?/Uwpdv4fqw80fnfyRYV9l4kf5fK1f5rnrLEAo+zNfpwyvBqEikEahuY3rfg4?= =?us-ascii?Q?ZWSAggJUJlCuCJ5MRUjWixjzPXUDQwN1BRbzWUAbid+w+KPhObaaMopqdTSd?= =?us-ascii?Q?E94/RNRHzHpqktS9ZZuW0XTwvUlHdP6JpxFCSGwXLy2HvWXYbGMMfabcfZuh?= =?us-ascii?Q?iQnhjEl+5tKW7vw9jLIvCJtOZFYJ1ResBVqgT9FDB4erF77y3lcyGdTWn9mX?= =?us-ascii?Q?/w=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: fb211586-15e8-41b5-995d-08db35b36b69 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2023 08:54:52.2078 (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: gc/cjs8CyGPm/Mf4NfrtD4nOHPNtD8Bhf9zsp2dKTGChJPEPOKXuPcPPn1dFahg8bsSd1gEEDeVJHmlths646v5KMJT1/9GaKeh52i9ZN1U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR11MB5491 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 On Tue, Apr 04, 2023 at 06:04:32PM -0700, Stephen Hemminger wrote: > On Tue, 4 Apr 2023 09:47:21 +0100 > Bruce Richardson wrote: > > > My suggestion is to use a combination of these methods. In json_snprintf > > check if the input buffer is empty or has only one character in it, and use > > method #2 if so. If that's not the case, then fallback to method #1 and do > > a double snprintf. > > > > Make sense? Any other suggestions? > > Glibc has asprintf which allocates the buffer for you. Good point, I'll use that in any new implementation. Thanks.