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 5ACEF428D4; Wed, 5 Apr 2023 17:47:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8BE941156; Wed, 5 Apr 2023 17:47:46 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id C81AE41153 for ; Wed, 5 Apr 2023 17:47:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680709665; x=1712245665; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=tXCSLlv4ayzBo+cr6wihB7KCMwOm/OMqS4S8X/QT604=; b=ae4Z7D0mgdit9FbL+QS7C/9lBv1WBKe+E82ErNvSsFV765RCgYS53waR CZICY5glf60kTqkIRgOCuhthdS690ligge0SSJLUviXaHMN5WtIiSSYLR 9qet9mYpKOc6Yvo0qebTIgCdIZCTLBWNuSn2am+aVJDWhTJSoeo+tXplO ikaMNa8yXEMSvL7zG9zSVyygrbztaINhaaTMREBOmLB+u807ad35cboru 00JUBHlarWJk7ALjv3ym1DwXBRKcdOPxTXmU8ZPl+8hRJMBdPRlRASK19 NbPDT1SEtL2KJZozJqdtKOCN7KbLFKvAl45m96lkiBJwDIE2N7s4cDo4L Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10671"; a="326526826" X-IronPort-AV: E=Sophos;i="5.98,321,1673942400"; d="scan'208";a="326526826" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2023 08:47:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10671"; a="1016511639" X-IronPort-AV: E=Sophos;i="5.98,321,1673942400"; d="scan'208";a="1016511639" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 05 Apr 2023 08:47:36 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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 08:47:36 -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.21 via Frontend Transport; Wed, 5 Apr 2023 08:47:36 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.173) 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.21; Wed, 5 Apr 2023 08:47:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HBrZQ4k5jbvS4d+JLL6tUb7QO4nMryDyEQtx4n5L/LbJlNlz160RN8y1SlEYj7I0fINA8KfLzVgKJKoseOK7w5VU+VddcWd3G8LXWfggiMbqIBu/Jsw0+Fj15KLxOBWdb7b+oLitftcc0J2QJJl/c97EC9LMLZAuN3wYbeY70prUFZ9Fy/Wy2NN9rpDUXg8nkHKSRYQAvBqUg0XJXXQqw0FiaUCYMxxLQLfPXNONe6lyc5jgZ3YWoMkQ1U+047SLCeCV2R4IbTUDb5oRVjeXvFUh6D8LDsp9nEDzSWTEHYP4a4pgf8Mqu5xaTpgSE91iHUWOeYuP5PLO+gf+7LObtA== 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=kANkQoKzbulMR5tRn9oXZ+EsXXX2vu8U1ybQlqCYRX8=; b=TUPEk5PFCQ7CwI+hTQSB+EIM4vs1bXZWxDKzN5qRwsXa9onuqS1yJXkb4UpQAgqmbNgkhwug96d63jIGPgnpgcBFdV2xymsC3TlGJi1yz2Th2JEqWcs6/PGM+uZtIN/kEgO7/404R8TgTL5vm4C1eRee31jJzzMJZgcRoaJop4N3G6NmT5qMfrbAc4YJKomMIgWK9Xy9ulTwY8FZPR04BHvYSAyjVILbNTMm2UUjr+nquvj0S8m5wLnv/DtY1mkGCN8LREd9DHOb/craRuubKNizV4dy55+dR9v8CtbaomRaOzzca3r/K4MRdDgOCiNr+7VsIpT98uxaP7yqDwgwgg== 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 BN0PR11MB5710.namprd11.prod.outlook.com (2603:10b6:408:14a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.30; Wed, 5 Apr 2023 15:47:34 +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 15:47:33 +0000 Date: Wed, 5 Apr 2023 16:47:27 +0100 From: Bruce Richardson To: Tyler Retzlaff CC: Stephen Hemminger , , , , 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> <20230405152521.GB28418@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230405152521.GB28418@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> X-ClientProxiedBy: LO4P123CA0318.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:197::17) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|BN0PR11MB5710:EE_ X-MS-Office365-Filtering-Correlation-Id: 6df5f2fa-a9da-4227-996a-08db35ed1230 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Em/bYlax0oCtaV3als3EBGWN+bHv2eJX1FvyZCHNcaBHkEBi3rlyN3bAK/Xdy1fbhLgjuDiSdO1YqQ9/qC8g+xqxB4fjrLiTS6gBM6ziEtwClipy8fJC31dhSRsAGa7nwzp+gn3u2koId5mB7YZmT/Y26P82DL2kOA9fUPMUObr6ma2q9CRwSw8lcO1gaAUEwGsEY/x1cW6mr9Em5CsCeycsuVUxgucCufTUrs+aZgecWks6TeMm2osc7bRZVaXfexcicpRsO8Pqe2wqN+h4nx3qThJoEqgKUPcC3rwVopoJfkYKWitlfDLVRSBA880KwbfYXKBY+U4gQ5pXuo+F248v5rvgOpE7WNrPICJSGQ8fbc0Q3gPHy4/2EmNb05KOv0AnKdPE4ITUKqNVlyKmRVAg7NsOJhYyQafsmfpZsrjLwOmbYFuLHHnYo8p+6VfokPz6TTj2yDKrSlMWvdC51SA7wDRDdhqYh88XjqDX8s5u/fPVW2ID3m9WSZTQfZ6ivqzkh4qjlXpgZaAf+cYIzbwWbPW2O9PCkMt2DQfLNUMJ0eR4pd7NaMWKFbz0cKCp 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)(346002)(366004)(376002)(136003)(39860400002)(396003)(451199021)(6486002)(2906002)(83380400001)(478600001)(6506007)(5660300002)(6512007)(41300700001)(8936002)(26005)(186003)(6666004)(86362001)(316002)(8676002)(82960400001)(4326008)(44832011)(6916009)(66946007)(66556008)(66476007)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GU8d0n/FwucEh9QhgOEWJnRH4Z7mmf8Ga9JsMPCoWk1eQ79X4E8yYkWC4yOf?= =?us-ascii?Q?iSYcRJeF23iKMlwrGxJSQuS0SNtkN5skgJrliQW5Pw0u6QTzlvBxvjXVv/0E?= =?us-ascii?Q?NL79BSomaeCKMS4oURmYGZ2wdgmaGuCHyBWdkd4yDSx014+8OSvCUVHNeXap?= =?us-ascii?Q?cb3fWQkZDP0SOg677bFtiLXd24KMV/Kz+SdgbVDjgGV98RPgGG/iQojlOrYr?= =?us-ascii?Q?763Bk9KFNN1uafJNJFIqDVUo87/KfXLRWEuaoEA6FdLcFecQPNeAhKwUroLH?= =?us-ascii?Q?V2gQcysuyZMzhMXQyyzsot+vvvEHyLXS+MLby/nVO4OmajI9xsjOCUZKG0gO?= =?us-ascii?Q?7cCwpmBjMHajfdhG1a8BO1fF4TPZgFO/0SVm0GD9jg2rmKdCqpLgN3ywG7QX?= =?us-ascii?Q?ujMId+cAWZe3Maf4jjmvsK0knXmjQnzHJLyBkV6nZkVXsHpYWfxaazcBwgrq?= =?us-ascii?Q?kPC1xx/EcobOSWhvdNGauyIzxzL75dPyVanA3JEGIOPPXxJx+x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kk5mUKddWgVFqGYcw6ehcKn4bvDzygCh2t8af053chgelfCTtcRAtSG?= =?us-ascii?Q?N5cOk4sS62FIFIj0rJmsFKTRPVSMpWcQraav62eUpfHKuZdNxbZSnMt93CTT?= =?us-ascii?Q?EKkRSlwzWlm9GnQCwqnjTt67WnncRhZ3PF7aR+6bg+2504EyeyIsp3E+9KTW?= =?us-ascii?Q?8O6Lwf2+yTdlzP7ldoQebmnz2tW/jJ8Rpu7QIxoCe6XU822ok7CeYvtkEO0l?= =?us-ascii?Q?Hg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6df5f2fa-a9da-4227-996a-08db35ed1230 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2023 15:47:33.4544 (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: oJOnfOJb3INwXKRRg8SuQmQD2hO36gO0kiKz8cDyqdQHeHTBrb138NLFGcS/6QYbUlULmprZ6AR7MaNl3iCGmjRA6wmnaIOQqRaRhEu1lts= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR11MB5710 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 Wed, Apr 05, 2023 at 08:25:21AM -0700, Tyler Retzlaff wrote: > On Wed, Apr 05, 2023 at 09:54:46AM +0100, Bruce Richardson wrote: > > 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. > > i imagine there is an equivalent to asprintf for windows but keep in > mind it is not standard C so you'll have to do something conditional. Only noticed this now, after I've just sent out the patches! I'll have to see about more rework so. :-( /Bruce