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 1E5CAA00C3; Wed, 21 Sep 2022 15:58:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EE4E410EE; Wed, 21 Sep 2022 15:58:12 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140085.outbound.protection.outlook.com [40.107.14.85]) by mails.dpdk.org (Postfix) with ESMTP id DE0164014F for ; Wed, 21 Sep 2022 15:58:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZTCdER1Q4zp4VZgp9yf+6svY0Oy7XJ4QHBwmpaJoSJ+zOTmd4qaXTt39uUt1EBmWJGU7pWTOB0KLSEZqrTaYPCDElD/qlnihJv8pKHtygrFFrE/51sW7b6fuYnM90Rv2HBtTrm2VC/nBF0O7twxnDGAGWPkqIR0077x9icDKfS4wIZr7cVkIqmXU5qRPL0SSdvS6eS0ThH8XSkuf7WyxzxG1PEhWEu+E8qEN2tmL2/6cjJzXxMu38R+KoZGjpS0wdiH2llJcSo0KoMsMpLC3j4ku6NviLJeXCZSZjV6cO+wJSyraxsTaYoDYMCv8vQoDhp3kh/KmY4VynLfMO4WxWQ== 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=k8zrLxVE2eFau5r4MmoW1YNrg7kLJxKEnOkvFkwqwpk=; b=bCOembUILlP4U7EOPoSA4DAMRWKiADPGgG/1OTGUO1mbwca2j9KF0iuHFkF5P+pVRFMsCaZLe42Hg59kKfWbHUIt5++P84+CpldIYkiB2aRocjtBtKViM8t45G3+QQ9/WUgnHC996b3loGLzIFxR3BOD7RDWIkvxSfenD38177KF6l1wIO2TIgbdYD+Sk2HzH6mSdgwcO2O/MeMeW2SYFNIAx6JtQXuj5gdKkhax5kTiaN3qi7hNr73mjuxke4mEoCSGbo/Vmh42Tu6qv4MSTjVnEgMQhCygsL1+89QdSwdq8Xe3NmEzSRvMxBpwDQXf20W/zCbB7Z2bK4d68aPP6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siemens.com; dmarc=pass action=none header.from=siemens.com; dkim=pass header.d=siemens.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k8zrLxVE2eFau5r4MmoW1YNrg7kLJxKEnOkvFkwqwpk=; b=uAZzDaKbtU4viQKAPXiLsawCi0tYWWtAwmzfaCZiqdsLDG4JL3J7s9OwNasYfaxm2RQOUOkBunPgqdczGt+YE7FFKlWyeXzDT/6l3VXhjYygmI7/sW4JjFcGL6/vuQ8YOjbf1unF6/xsIU3snHuntAWFMbHjvTntR+zSdl3CPrk8cEt1DZOxJRxPzt9XHoQVkW39CrfrnICxIO3Q6nu0x5ZAgYoiwIGWSy89we6RYrQzZKeVQJOySlQ27dQiWhgQ5+Bk6+qeS2Dt9iih0zAWG6sNi9u7VbzquSA98hosJoqTZj2eCUHyahjZrO46H/i5x9B4Gqwomq0k1DsSsGu6zA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siemens.com; Received: from PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:269::8) by VE1PR10MB3917.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:162::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Wed, 21 Sep 2022 13:58:01 +0000 Received: from PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM ([fe80::e4a0:49e4:2152:11b1]) by PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM ([fe80::e4a0:49e4:2152:11b1%5]) with mapi id 15.20.5632.021; Wed, 21 Sep 2022 13:58:01 +0000 Date: Wed, 21 Sep 2022 15:57:59 +0200 From: Henning Schild To: Thomas Monjalon Cc: Konstantin Ananyev , dev@dpdk.org Subject: Re: [PATCH] lib: do not call memcpy with sz zero and null pointer Message-ID: <20220921155759.7d67d523@md1za8fc.ad001.siemens.net> In-Reply-To: <6425132.G0QQBjFxQf@thomas> References: <20220907150503.6212-1-henning.schild@siemens.com> <6425132.G0QQBjFxQf@thomas> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AS9PR06CA0160.eurprd06.prod.outlook.com (2603:10a6:20b:45c::23) To PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:269::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4PR10MB5780:EE_|VE1PR10MB3917:EE_ X-MS-Office365-Filtering-Correlation-Id: 08d7bcf7-173a-430b-c78e-08da9bd94c17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SUPzBok8AaVzNLPognJH2DA/7XCX12c4L+EWDBJfZh0W9m4jctqxAxT2HLIV5ar0Cwzf6N5kgcnCsJkb6HIERnMi6fwl+m5/gbJZlfHoN9p7HbyF/mbcFqLM8McqBZ/g7U5zXGNkrEd6SP8rL9OJUDSwQuyT1mu2U152ytiLh+esA9zFwSxXAbB/If35MYy2HjcF7hb0NeIeAurIlKvd/urBFR6XcpSYuzHqHeK0oHVns2yJM6GVTByYjvhxcoE1IjqUFsOFPsVVl4/MNdqI7fJWnXnaDO8Z12xgvNRwmWRNMjqZdG+FK/oQ5YzQIOWs0bH5tJvqju5tFEX+d9KQmtDfEup3xJIO32C5wGSjaRFrypKoDhu+hcs1YIm74Z8/Pou28qDVm3ICqf8B184F8izrqDdoPGoZPvTmx4tgiMPVsLRNUS1hjTboA78AJ1BERsX2dCM9kSGvpYCYsliuxApMjeZFQi1tGIQWSM6qATFz7Y0bTV6kJ7ZD4/r6IX4r+Oly+PBeZWcXo0EIo3GrhFuFBP/BVQd5t1UpET+d8vPUQcQrmbEpRJeiT1K2htv/OCuCI/SCR8ryuHxxihU8LvVSeWn/JZN/yQGrvZhMaAZ5EmS4PMXwU3XrfV+dYzyd5rDBYOyOXNlm9oN6Ues1ahN2VMKvJB11dKdN9iZQpcdsDDN6HFy4YFIyu3Ot/1TqPBCEa+jOQQo29LG3ibVd5A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(39860400002)(346002)(396003)(136003)(376002)(451199015)(41300700001)(1076003)(186003)(83380400001)(6506007)(8936002)(6486002)(316002)(66476007)(478600001)(38100700002)(66946007)(6916009)(82960400001)(8676002)(66556008)(4326008)(44832011)(9686003)(6512007)(2906002)(86362001)(5660300002)(4744005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?r7w41tzqTtPlTL+lH2EtwWHDlOMqG8rIHSISQ4iF9iQZUq3LE9T021EeHt6l?= =?us-ascii?Q?03txJf9+ZFnZS8mLwj5bKKNQRLgVgDl0Px8sfS4hdISPPpYiwqD5bt4zDSAm?= =?us-ascii?Q?DpryAVoMgQUfl2tJpGKJrG8B1AdcJjnX753/UPZ/IV6Q1jjl3HIXYB+UGuaG?= =?us-ascii?Q?br/c+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HoQuO1c?= =?us-ascii?Q?dC8TkwxjUAHcB/QCviz+AojVf6MpJK5wahCzmelewlSVRGR4Xb2eoQWnVA/S?= =?us-ascii?Q?LxcZ0PXd8wMyTkKuETd2xljIHnD3Ur+pO/qNgXpW0PiqMGAtKq4NJgvoL7zc?= =?us-ascii?Q?/Je9ZRZY2fbyotbUva2+jG57Z5WQcVZcyZj7Vm4Mzx3WxYB67eesSkhSgxfM?= =?us-ascii?Q?gbZBniZx0+4aoZppXNzcGSBu7+wb93dc1bWaq4LvajWMraTz3bg2DsIjg7yd?= =?us-ascii?Q?9XBNKdqNQq1rZjzu/FQO7K+wKEw8ybmwIwZym6V5U81KgvNftnI1ahx2KJhS?= =?us-ascii?Q?oqaNruCIJNXJSKslzI8mccmMUoMjEAZXXXYnNOHt013h0UIlXFv8zhUUU2tP?= =?us-ascii?Q?s4dlswpc8PgWMzTh0pUtoxlWcOQwG9VmPj4ECgMmHtSIJtReY1u6WR82dxt3?= =?us-ascii?Q?o9MYsTl/scRdKu9Z4sdvqDpFCNdAAaEeW0o2lKZBW0Ys002vVzBWCn1C/TXn?= =?us-ascii?Q?yWKpoplG357DdN9d75XbWwEjPMkXxEuARPXqHluw4rdW06RFdmL1LGQTKYUA?= =?us-ascii?Q?s485AWrzH/7zBhWc1xVNI74Gzx9U3WP85ia4It89w/MsAaXheMCGufLIRyRQ?= =?us-ascii?Q?3Xt3vQ=3D=3D?= X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08d7bcf7-173a-430b-c78e-08da9bd94c17 X-MS-Exchange-CrossTenant-AuthSource: PA4PR10MB5780.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 13:58:01.5525 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wLRZFhLFTS0/DY6y2P+dp0urZd70SVug++Np9/pXrPZXV4Zm6nY1cnkO62aZGqXCPVVL08HUbcrdoRNyAkIBrpR/f6iTRNsUSTUXi5eBWWQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR10MB3917 X-Mailman-Approved-At: Wed, 21 Sep 2022 15:58:10 +0200 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 Am Wed, 21 Sep 2022 15:06:12 +0200 schrieb Thomas Monjalon : > 07/09/2022 17:05, Henning Schild: > > There is no point in such a call and UBSan complains about a call to > > memcpy with a null pointer as second arg. > > > > When building with -Db_sanitize=undefined, Clang gives the following > > warning > > ../lib/bpf/bpf_load.c:37:20: runtime error: null pointer passed as > > argument 2, which is declared to never be null > > > > A check of the sz before calling memcpy fixes that. > > > > Signed-off-by: Henning Schild > > --- > > --- a/lib/bpf/bpf_load.c > > +++ b/lib/bpf/bpf_load.c > > @@ -34,7 +34,8 @@ bpf_load(const struct rte_bpf_prm *prm) > > > > memcpy(&bpf->prm, prm, sizeof(bpf->prm)); > > > > - memcpy(buf + bsz, prm->xsym, xsz); > > + if (xsz) > > + memcpy(buf + bsz, prm->xsym, xsz);* > > I assume I can safely change it to > if (xsz > 0) > to comply with the code style. Sure, thanks! Henning > > Applied, thanks. > >