From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E8B9DA00C5; Thu, 30 Apr 2020 15:52:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0DDA71DBDB; Thu, 30 Apr 2020 15:52:37 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id A835B1DBBE for ; Thu, 30 Apr 2020 15:52:35 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03UDjNi1006763; Thu, 30 Apr 2020 06:52:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=ZpqKcZp9ESF7bPOcgGuvP7w7cCXjOZhPUA2V1Vc+UmY=; b=GOQvqRKa3Tz8mokLx4NfKS/BGQSpMgo+4RWqwgQkQFwDkgExOA4YpYaJszSEDOTFJQKs 7/6BjJyDjl4ltQb74oKk0Z1pCgUlJDRsktPHCrVKKWYyn6zpgU1Olu8EHUsEmYjRLMCo EwJOTlQQc42ozdDQlKDNfNhYl6bup1tVb0sPqPPpQwZG+Q+zn6uacQzJlLcyHTmvAd4a bhQ4rZl4GAh1Yd8oApJFtUxkeqjLdr8EYZJ0RjSlPuZYUJtXx7BO5hXNsWoqc9se0WxE A5FgNWN9odZv26n0v3P/8WMXJq45Q20UutKEBtRGER7aJDEsXu/qesWng8gMOJZRlGRD lg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 30mjjqpvs8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2020 06:52:01 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 30 Apr 2020 06:51:59 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 30 Apr 2020 06:51:59 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.53) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 30 Apr 2020 06:51:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dUZnhvbuoi+gZM9oObZLGoo5q9RHQZz3QyDX/UICWBwltcFWo/nCprkpVcreJ9RMo1EuRaAxt/MLnXUV2Knfwnuon1SYw0Zq7KmR5a88rhWuVFOnv0vabPW7/sMLWy+N9ir9zvzgiCIUY/KDK5zZCQBJm2QRP9B6uXLACNAbWYqo9Cvp3EsDSyiYxZLg8Gc43d/wRu1+rryqA4B8whD+JFdbyc/Zi3prWUuOBlSgQNIRPD9xk5hLfFC3uODn1+o0+h+e5x3H6A1Yqnk2+sWAfS6p2T59TK1xDp9PCo9ZaYtPWM4gmzUd6iGivLMmhjvUGkGF8WZCcAMyo3FR2+Zhvg== 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-SenderADCheck; bh=ZpqKcZp9ESF7bPOcgGuvP7w7cCXjOZhPUA2V1Vc+UmY=; b=eiMpsLNzLauj3mr2QttcQeQWpJdZLWw5+tSC++ddkHAWs9OEmiItLGMHN0XwOeJz8piNkMHsYRB8rwE1os6nlFXuDR7Kp+BgBt+hVFfucr/gvwDXhsaUPLv6b4NCDuj1HYeIW92dgy+b06KkAt5385auITjXA2gksnk0UH90tFtN6qnrFMZHc/jjIJqlvq3F8Tx76ffWUb7PJf5LSgMQ5IVsVnHhSjxLGVch4law755TB0hrpx6e00444kB73zClGqV0BC6S9XerBB/5u7xfmAlfrfX6rxORQEZdQDJx9BhgIT7H/goo/EM/oj4rXI7uTNfK562IqtDSuyErYglRLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZpqKcZp9ESF7bPOcgGuvP7w7cCXjOZhPUA2V1Vc+UmY=; b=HN8FbGlZfbqwcMIpEQn4/w6DSE1+3spWgMZ/82scYapUU469mgJZpxQsXJX2j2hnsjBW8ypLdYpLDr/ZQJUo/bWY3xprQNdYqyQzRORR1ttdUfDtkw0MvTMLhVgKtc387c52VWG7floDPQgzrH943eX4zExR1/sZ+iSixRDTGzk= Received: from BY5PR18MB3105.namprd18.prod.outlook.com (10.255.136.94) by BY5PR18MB3764.namprd18.prod.outlook.com (20.180.55.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Thu, 30 Apr 2020 13:51:56 +0000 Received: from BY5PR18MB3105.namprd18.prod.outlook.com ([fe80::cc6:c7ae:dc40:7ddf]) by BY5PR18MB3105.namprd18.prod.outlook.com ([fe80::cc6:c7ae:dc40:7ddf%7]) with mapi id 15.20.2937.028; Thu, 30 Apr 2020 13:51:56 +0000 From: Sunil Kumar Kori To: Phil Yang , "dev@dpdk.org" CC: "david.marchand@redhat.com" , "Jerin Jacob Kollanukkaran" , "lijian.zhang@arm.com" , "ruifeng.wang@arm.com" , "nd@arm.com" Thread-Topic: [EXT] [PATCH v2] trace: fix build with gcc 10 Thread-Index: AQHWHWqml0+SimWE20+JPgNcIguSc6iRsQXw Date: Thu, 30 Apr 2020 13:51:56 +0000 Message-ID: References: <1588006058-10728-1-git-send-email-phil.yang@arm.com> <1588084627-18772-1-git-send-email-phil.yang@arm.com> In-Reply-To: <1588084627-18772-1-git-send-email-phil.yang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=marvell.com; x-originating-ip: [2401:4900:169a:eac8:c127:d806:20cd:256b] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4227186b-f02f-4b3d-51e4-08d7ed0da5e3 x-ms-traffictypediagnostic: BY5PR18MB3764: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:221; x-forefront-prvs: 0389EDA07F x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR18MB3105.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(366004)(376002)(346002)(136003)(396003)(66476007)(8936002)(86362001)(66946007)(8676002)(76116006)(66556008)(33656002)(52536014)(66446008)(64756008)(316002)(478600001)(186003)(6506007)(2906002)(71200400001)(110136005)(54906003)(7696005)(55016002)(9686003)(5660300002)(4326008); DIR:OUT; SFP:1101; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: aNV0L96evzH2jeVepWnr0WEcM7Zr0qkbfqtRR5JfwRZGUvzhB5/vX4eJOKhXVguBKZiB00VZvO3CTVoE/SUcC4v6uY5nRf455dIutuxgRGTLRPcKRd3PZwihDCMWI7YoKQDHF7W8ksGLmuQZDpnR9a6AOzkQ/1GycXJGN6lCpJvet8ATAJCskEv9fh3zLDFquc2S0UhGDf7ZGuU7ucwudA1b9uB6M2FjWS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S24zyNT2wgaDCVCb1Bx+KfUsgXj1z/QIEBuuL/9j14YIv2IatJKvjS1Dm2FV6 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4227186b-f02f-4b3d-51e4-08d7ed0da5e3 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Apr 2020 13:51:56.8031 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: MvqqbR2Sj2AwKKEh+i+Um3cjC01XwFUmJ1wObWGGxFurcH1AnecxWo4FZP3ezvybMmXu2vWV5aUNpzl10FtWLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR18MB3764 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-30_08:2020-04-30, 2020-04-30 signatures=0 Subject: Re: [dpdk-dev] [EXT] [PATCH v2] trace: fix build with gcc 10 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Looks good to me. Regards Sunil Kumar Kori >-----Original Message----- >From: Phil Yang >Sent: Tuesday, April 28, 2020 8:07 PM >To: Sunil Kumar Kori ; dev@dpdk.org >Cc: david.marchand@redhat.com; Jerin Jacob Kollanukkaran >; lijian.zhang@arm.com; ruifeng.wang@arm.com; >nd@arm.com >Subject: [EXT] [PATCH v2] trace: fix build with gcc 10 > >External Email > >---------------------------------------------------------------------- >Prevent from writing beyond the allocated memory. > >GCC 10 compiling output: >eal_common_trace_utils.c: In function 'eal_trace_dir_args_save': >eal_common_trace_utils.c:290:24: error: '__builtin___sprintf_chk' \ > may write a terminating nul past the end of the destination \ > [-Werror=3Dformat-overflow=3D] > 290 | sprintf(dir_path, "%s/", optarg); > | ^ > >Fixes: 8af866df8d8c ("trace: add trace directory configuration parameter") > >Signed-off-by: Phil Yang >Reviewed-by: Lijian Zhang >Tested-by: Lijian Zhang Acked-by: Sunil Kumar Kori >--- >v2: >use asprintf instead of sprintf. > > lib/librte_eal/common/eal_common_trace_utils.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > >diff --git a/lib/librte_eal/common/eal_common_trace_utils.c >b/lib/librte_eal/common/eal_common_trace_utils.c >index fce8892..2ffb8af 100644 >--- a/lib/librte_eal/common/eal_common_trace_utils.c >+++ b/lib/librte_eal/common/eal_common_trace_utils.c >@@ -268,7 +268,7 @@ eal_trace_dir_args_save(char const *optarg) { > struct trace *trace =3D trace_obj_get(); > uint32_t size =3D sizeof(trace->dir); >- char *dir_path =3D NULL; >+ char *dir_path; > int rc; > > if (optarg =3D=3D NULL) { >@@ -276,18 +276,20 @@ eal_trace_dir_args_save(char const *optarg) > return -EINVAL; > } > >- if (strlen(optarg) >=3D size) { >+ /* the specified trace directory name cannot >+ * exceed PATH_MAX-1. >+ */ >+ if (strlen(optarg) >=3D (size - 1)) { > trace_err("input string is too big"); > return -ENAMETOOLONG; > } > >- dir_path =3D (char *)calloc(1, size); >- if (dir_path =3D=3D NULL) { >- trace_err("fail to allocate memory"); >+ rc =3D asprintf(&dir_path, "%s/", optarg); >+ if (rc =3D=3D -1) { >+ trace_err("failed to copy directory: %s", strerror(errno)); > return -ENOMEM; > } > >- sprintf(dir_path, "%s/", optarg); > rc =3D trace_dir_update(dir_path); > > free(dir_path); >-- >2.7.4