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 0DD25A0C45; Wed, 22 Sep 2021 11:21:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0D97411A8; Wed, 22 Sep 2021 11:21:13 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id BD14A41198 for ; Wed, 22 Sep 2021 11:21:11 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10114"; a="284566111" X-IronPort-AV: E=Sophos;i="5.85,313,1624345200"; d="scan'208";a="284566111" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2021 02:21:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,313,1624345200"; d="scan'208";a="703651808" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga005.fm.intel.com with ESMTP; 22 Sep 2021 02:21:09 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 22 Sep 2021 02:21:08 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.2242.12 via Frontend Transport; Wed, 22 Sep 2021 02:21:08 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.48) 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.2242.12; Wed, 22 Sep 2021 02:21:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CK0bt5ZrqFMAGQ5pq6zOxmx0noq53+xXZIPyvqWXF7adGZaXiuJYp47Zu0UcJsAwHxwjSFI46PcKZCTQW42CpR4D55ItkZWXEWMmzxTTbRNHYH8tZMFGe8Ql+GgwT4lVaG5VoEYKTo6JO7sP3tnGBnGoHtz06ftQzWg7gLWPnIcakL1rFv6JATK6KUzWzP1KskEVJ/qc8+Q+Z/FhRlvb2XwX1jhbDj/rOQ2yp5rf7MFHGmDA5pqrnsxqZ+MB0ZVeKL+k+OYpOhMH8m8BgPbOWG2Ca5x4Cu9F5fP2OYNJwxq18oeKN3CjnlIba/WRNGtGPhGUszCt7X+5X/jGPmLKxA== 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; bh=13GyvdMdJGPu8wv8gOPHnIVc//5s9xBvB/a+R2D+0wQ=; b=DewxoJyBqWyCjGg0aOQITN5aufaCvCbnxCrJeDUjhfLQOh6wOSlrd7ASMPSsiITiO214PFAProFAOCoJg+S1HWpUCrdGSmFHPBsQaXlZkJDGPA4BDXDrI6bmgLsgysZ/pbXJurAC94S6zY0QKta9LxGGYteC9LSDiKibiiq+eDVnH3YX2Y+/XsBgIhqvEuo1GXBkT5sKE+92PttHB3OxDF4/gf/P8iyoYP8XWs44M/O7OMRbDVN0ZzQPVNxjOsA/xzukCbJJWyKtGyac3hlty1n9P720hXyFvH5zBrJKOgfLtpQIRs2B+SvoYjtbAfylu5tjjvUEy9RRaCUk7B1SOg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=13GyvdMdJGPu8wv8gOPHnIVc//5s9xBvB/a+R2D+0wQ=; b=ObqsecRq+FkvSygU4yqxPpVG3vMQ62ig++zIIvtQfGOBoLozZO4EViq5SQEVTbvt4HTOx4c57twzqnIeaYnG/ey5/ddf3+/HmxzilQRNnOHrtbsJjAiB+vBDux/NVs2j91N2uF3j4Ij1hGmPIDxoEx6aABAWA8/1sLvq0QMVTUs= Received: from MN2PR11MB3821.namprd11.prod.outlook.com (2603:10b6:208:f7::24) by MN2PR11MB4045.namprd11.prod.outlook.com (2603:10b6:208:135::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Wed, 22 Sep 2021 09:21:05 +0000 Received: from MN2PR11MB3821.namprd11.prod.outlook.com ([fe80::304c:39f1:9d95:4ba2]) by MN2PR11MB3821.namprd11.prod.outlook.com ([fe80::304c:39f1:9d95:4ba2%6]) with mapi id 15.20.4544.013; Wed, 22 Sep 2021 09:21:05 +0000 From: "Power, Ciara" To: Gowrishankar Muthukrishnan , "dev@dpdk.org" CC: "Richardson, Bruce" Thread-Topic: [v2] telemetry: fix json output buffer size Thread-Index: AQHXrthAvQTHEc+Z0EiUoJioWg7zR6uvxxUg Date: Wed, 22 Sep 2021 09:21:05 +0000 Message-ID: References: <5a95b25b81e7ee57edfdcea73b9266bc8dae8d77.1631120194.git.gmuthukrishn@marvell.com> <20210921110243.1919933-1-gmuthukrishn@marvell.com> In-Reply-To: <20210921110243.1919933-1-gmuthukrishn@marvell.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.200.16 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4cbdffe5-b677-4982-bad1-08d97daa4dd6 x-ms-traffictypediagnostic: MN2PR11MB4045: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5dXMqrL1Yo4JBgMUa5++LxoC4ciXy4GHQ0+H5IPsPx3DTO/RwEUAMVYwUQYToEk56kuuVerjvXzDb6ZCX/o3ZSlvpJ+7hA99m6jXRc1HuWl9O5CD+6gj53isTHGTQdBqckdoEBDTWosGzMboitAgVy6bYS97kXUr77gSq5BHMNZyCAg4MWTarz4ele4ol2V9WJUyzh0lgKkeLOe8n8FC7aXVQwSO0FpOK1VfsJFTR6654ITNlAu1npNhkP16+wL093AIPbdsbdL+qpNzIt258yvRb/Z2d3cs2nKvvqEZrk/4j5XrNKK4NlAVzNo+JzHrKiYnmRO2z4mNesmfkW+TyJJvDL1Xt4aa0GlBeEK86RSQPLzYSbGmSW5x6B18MhvhWhEDnj6eKVK6bWo5xDZClrhCI5ddFwSkZLLiOLatOZDp1cKcgBWe5UKwv+PwHnZrprwDxz35hrlfSj0xcojGB85eqkhETwQTEJBmWJ2ydKbszEuh8IsqGc9ArRR6SrKYvCIWxNKJni3Ptt2BynqXEmkRWiXGuFXl8bhRU6qAEpFTB166GrCVyvMUtRVCBi9rpOvMoOsHfic4VRitZMFa0cUgweSVdti2+FslAJ3YU5odBvnRc0vJWS+Lv/14xwSTVnZtJLiW1QYUpTAxlvSieVnRVCGcOlQIsd3/RCbXRWYqLAd2cC8tjQGfkiGDsImqyjBeeYX9u4AFQE1q4OZwEg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB3821.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(107886003)(508600001)(66556008)(7696005)(52536014)(8936002)(33656002)(64756008)(4326008)(83380400001)(110136005)(76116006)(316002)(66476007)(66446008)(71200400001)(86362001)(66946007)(5660300002)(9686003)(186003)(8676002)(6506007)(55016002)(38100700002)(122000001)(26005)(38070700005)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Ofyal9kdwURpSvbmNrsINjNTQYm1xqVPptkaQzEMWWAfYU3pRXagc04u+imU?= =?us-ascii?Q?5I12HGbcJPau0nhEwV+8SuOP23+kT/pSeESgKKfSvySh6ZdBqiHIweRKThXM?= =?us-ascii?Q?ZfVuQBcIp7rx8Udu1O5ojiT7mTjL9gvRpnL3O5+oeg6MHcJ2LXmljs9xPp9c?= =?us-ascii?Q?G2quVe6qBDX7UQWt82CUu+SIXAlTnM38EqeafGnaIRaOCPNg6TgYstcRBehd?= =?us-ascii?Q?BgOf51Xz9ZW81Yh7/mKQkiPUD+Bl+puf1xsicA+8FrgU/4jMO7TcvPmkAPqo?= =?us-ascii?Q?HqiC4/xyLVY1lUUfN7SNLQ09v149GstOq7+1Q0VJCq90WOdGSUW2MlKVf6ko?= =?us-ascii?Q?8kTsKWoJ2NkSoQmnpbPg7sy72+zQC3N2lv4ZuzaLH0jEg3UAtki9FSSMrD6r?= =?us-ascii?Q?+Bbi5wKtRfTKbM76VFtoXQ8tWYqqMxaZ0GAkCi+H5QYDsfvOEdIamttOWRJB?= =?us-ascii?Q?cpsWNX+95xRVoIGXbUqIj1BAjDTZ24yUzTzcBMVWnL1KBZ8ryiBcKulSb/pW?= =?us-ascii?Q?ThDAIQQLEctQfBAEeVk6nCMEhIpe9T+S7TbO5ipbsae8svv+CBbP/BmvqhDo?= =?us-ascii?Q?6vqn2w+Yu6xLJu8v3ffKFV5YIfrtAwJ3NWUnOd97LtNDbKLPzALqxbnhjK6Y?= =?us-ascii?Q?7IHRBv5Y4vB3FKyfW8FT7MbcO20AuABHXfOyacTh1XJrf6XVWEJ27eo6G3tV?= =?us-ascii?Q?CVIdSWOoN46xwGBl5GVQOiez8p16hIkYnHs5Ipsd5n1/bMdo9rmwE0e6qTRk?= =?us-ascii?Q?8j0aBDvzZRv6dZAn8P0nzLZv8scQrEQDXpHyhZvvEPDUbgjyRJj8rqWcjqe/?= =?us-ascii?Q?ArCVcaPo01zJNgXLHXKbQm65LCLmUBNSYDGNYazd9utl7MuV+qVxisraOIwM?= =?us-ascii?Q?Wua+OqfUIzFHlL32NSRLs7jkw79ybdF64w2RZD1sGgQ9UQHHR8sbvTswmNfz?= =?us-ascii?Q?WASZtq+dWZfiBgGf/8ra1ovRUqVvnY0A9XN7HiWyGL5BGupedajW58tw6ez+?= =?us-ascii?Q?B91IiCLJoq5ViLKuZ3BC5adDjAbgpDdDMuLjEpT9ZLWGsFjK/sWyI6xLy+0h?= =?us-ascii?Q?6bu1zYb/NJZLeISwrGhS0GpsmsoHvnAKhcETnIXADp09iBh/UhmXo1uasaqo?= =?us-ascii?Q?/wTKVokivCS4qeP5ZIh8+mo30Nk19UF7+ANYkTKAGH743XvIfSw0eqI0CQDm?= =?us-ascii?Q?28OSmUWh6hqXwfy1NkjWYRaNbprVtMJusZQzZQlilaQtrrO3Hzv7xot1Rw4D?= =?us-ascii?Q?kQJ106vNisbU/JkGAAu90k24e2LhjtV3AkhrG2K2mXntnqEn6mtrlTX0qYTT?= =?us-ascii?Q?dKPLYtNnEgWlxK3r2DEnkMoX?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR11MB3821.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4cbdffe5-b677-4982-bad1-08d97daa4dd6 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Sep 2021 09:21:05.2257 (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: v89FpaUyCyVTYk3fNkY6zmw4OUgoBDnh3Upx1L/jM7y9K6irLabkETz0G5jOGpDw5uStOM+R0ZpF50L5BlOstw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4045 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [v2] telemetry: fix json output buffer size 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 Sender: "dev" Hi Gowrishankar, >-----Original Message----- >From: Gowrishankar Muthukrishnan >Sent: Tuesday 21 September 2021 12:03 >To: dev@dpdk.org >Cc: Power, Ciara ; Gowrishankar Muthukrishnan > >Subject: [v2] telemetry: fix json output buffer size > >Fix json output buffer size for a single largest value. > >Fixes: 52af6ccb2b39 ("telemetry: add utility functions for creating JSON") > >v2: > - split from series 18768 ("cnxk: enable telemetry endpoints"). > >Signed-off-by: Gowrishankar Muthukrishnan >--- > lib/telemetry/telemetry_json.h | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > >diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json= .h >index ad270b9b30..ba2fde34cb 100644 >--- a/lib/telemetry/telemetry_json.h >+++ b/lib/telemetry/telemetry_json.h >@@ -9,6 +9,7 @@ > #include > #include > #include >+#include > > /** > * @file >@@ -23,13 +24,15 @@ > * @internal > * Copies a value into a buffer if the buffer has enough available space. > * Nothing written to buffer if an overflow ocurs. >- * This function is not for use for values larger than 1k. >+ * Size of buffer is (single largest value - 6), where at least 6 chars >+ * would have been used for creating json dict i.e '{"x": ... }'. >+ * This function is not for use for values larger than this buffer size. > */ > __rte_format_printf(3, 4) > static inline int > __json_snprintf(char *buf, const int len, const char *format, ...) { >- char tmp[1024]; >+ char tmp[RTE_TEL_MAX_SINGLE_STRING_LEN - 6]; > va_list ap; > int ret; > >-- >2.25.1 I am not sure about why we would want this to allow for "RTE_TEL_MAX_SINGLE= _STRING_LEN - 6". The RTE_TEL_MAX_SINGLE_STRING_LEN is used to represent the max size of a si= ngular string value e.g. the response to client being {"" : "" } I wonder could we use the "len" parameter in some way here, that would be t= he available space to be filled of the "buf" being passed in, allowing the = function to copy in the maximum amount to fill the buffer. Thanks, Ciara