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 E37214564F; Fri, 19 Jul 2024 12:02:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE1CF42EA8; Fri, 19 Jul 2024 12:01:52 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013055.outbound.protection.outlook.com [52.101.67.55]) by mails.dpdk.org (Postfix) with ESMTP id 0391842E99 for ; Fri, 19 Jul 2024 12:01:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vWPhwootBXaUGxUygNvq7vsL51bNjSxDPdyNo3KVN0F7H8rSLUaBkCv7QDBSCWAwV82V2QSufVe0cz5KGLQCr5ZyL/7SipweH2zzTaetupZh088yPFS7GiTVTVouNs1gVYHhHtNi5vnfpsx3D26hzsZLuZ2coYInz3fVSBE6hBGYVOO2b4ZmUsPEiwnAYjQidSseDZfl+Svo1i4gunMl3DAsAzekaE3hi8pwMNMl8o8HGH1qIh3ySwXIt3JtLQLzxQt/+YjzW/uuaGJpkUGBOnxByFXPmYD87dIlVbg0r/lS2/IcBG7jUikuRZt0/NhqJ1/I9g3cZih4FmPvoGuUFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=+AVxen8sqOVcaBEJC8VijHv9b4h/Ki7xFCxSHndrNM0=; b=XxPBukJrhCkl4cpXhNyQX/04MZlAV/pg6kle+kzlqPiojOkSWoDh9vyOJN5HUZ5KVoBkoQwNY0abyGN2IsM0ycSfgIEQB7ZR4kk7ZL9kwAwVjEtq5v18ua084TUX/BN4dBBBAMT9fCRg2XSHRzK/xofFeAr7TzZ1yqLrRsNKx3Sjyy1NvFYCwo0GDYl/DDTKcaCxaeIVpCrTH0vMLFAkkeqlNfFEf3+3x2YbFBrDP8f3QruldqHo1rhfpjkd+AVng5OTJTnyMLafDwHNL5zm2nMddA8AENRr2Y1gdR/RTTulVRQv1Ydq5dWBrDaBpMVekf4Idf1THeVbnbdxxl4lnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+AVxen8sqOVcaBEJC8VijHv9b4h/Ki7xFCxSHndrNM0=; b=N8ec9uZ8ZGwezfZRVnvOqWchxlsQYAd5MilwIB6c17JBSWdTy0aIAOoGyd0rvT/9w05BhrrkezT2F173qtfzzMFOMK3F+ypWONGLCRDElGj4kLzDuqhBVKmHzLdwnZzsDsTvlemax+AFTo9QwM9vS62f0tqxvHlW67io64u1dK0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by AS8PR04MB7815.eurprd04.prod.outlook.com (2603:10a6:20b:28a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.19; Fri, 19 Jul 2024 10:01:49 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%6]) with mapi id 15.20.7784.016; Fri, 19 Jul 2024 10:01:48 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [PATCH 05/30] dma/dpaa2: add sanity check for SG entry Date: Fri, 19 Jul 2024 15:31:01 +0530 Message-Id: <20240719100126.1150373-5-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240719100126.1150373-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0184.apcprd01.prod.exchangelabs.com (2603:1096:4:189::9) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|AS8PR04MB7815:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cefe659-5fb9-49d1-8bb0-08dca7d9ce09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?8PyE3oOAn7NiAWzvRQ3RiY3jgjRhLBK47p/6eGV5lSj39keMLWcwncsW5oXf?= =?us-ascii?Q?FqeKP+t63UO1xjCcY/aErtRrei5j/zflVRjI/9+c/4fX9ix+natLd5bfOhkC?= =?us-ascii?Q?yNm2jvzXP9yoc0ZJUXtmtfEOkkK21mRcf2KpO30IYKM5VAjSpmQKpnk+u3Jh?= =?us-ascii?Q?w/eBz6QBrH6uZA+Y/jk7a366UbrMdde30EDOirlmK7v/VyVe/eZdKIEcI4z2?= =?us-ascii?Q?DcoJri9EF0CpeQP6UgaYeZwQMDv6/2noPKxyoGyNTth6KfdKSUaNc5QOWQ5D?= =?us-ascii?Q?DZi0xkv+reN04u4czvsciJU7jBcEOIhoQBbbqAdUNjtNghjLm2VRgFeKXrJO?= =?us-ascii?Q?wAs2P7hxXYp+ylz+853LjURUw+7Dx8Flfvd5t1URsffzPtQbUb0jMITXEwi4?= =?us-ascii?Q?+spn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Q9M9KPqSwtIDVJYbqY2FWVbygdx?= =?us-ascii?Q?YXhc20J9Y57qjJkYIuU4Fyou48QyC9Y6pOY4XKnjJ0ZAIEwRul0s9c1Dvj3Y?= =?us-ascii?Q?JjIepqwGTM5gOfUAijWSbHw82HZvv5DAZXwKacnAQtGFvLEkqA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8205.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?X/WwJfWiM+q79k7bNiVlgufK2rCy8UKA3QumMPPecR/59Eu1QtevaEqHIiHK?= =?us-ascii?Q?KdI/qcqMQIgBuPhV8GwBzI/8vHU/G25GCdWh2pUwkZRYm1cUuPwBqhsZvvhN?= =?us-ascii?Q?oDOH+TWCo/r9IqiQNYuhxNU96hIH5k2UBr2MpiRwgCTkLNYiX+4++GAoyluh?= =?us-ascii?Q?TLR8IFGSfCmEqHYZHR6Cp/Cr5mNvrT8OrlYAceHedPVOZlUT4ij8lWoKnvcs?= =?us-ascii?Q?FRtw1n9G167/h3Bwp9/eo9/ITXgtnZkcOOwawU/QtAxwcAIrKFCket56mUc7?= =?us-ascii?Q?n79j3Pi6tjcuQzWG0vMnn2e30xQO0XjNb4IGhqMlYZKwikxjRCzL1cOnmQ6X?= =?us-ascii?Q?p3LUnuACMzKceH1/LMkIu59qD04YaKIanuiekHwq25zZ/SXtYOAGR6tEkpZJ?= =?us-ascii?Q?/k6TFOwibSX1DwLeXZ71Cep2JHPm7iS88wXm20A4833v1S2eE1TpvSKEE/Hp?= =?us-ascii?Q?4yINNBOiulIMT8CGTyzsk96zjfibCrli190ZZFp0pHF7mEGPxyHmkNZkqOg9?= =?us-ascii?Q?xa30BBl7vp7gg2gdf+L+UoQT12DC2XtOYNeTQNyi5iWoXrwFsM4xJuKHBxrv?= =?us-ascii?Q?RMQerd49ri7mqSq8GAy0WmOsHh7NQtt8sY6eUWvoTezAQMSC1z/8AjlkzOkM?= =?us-ascii?Q?xAUe0LdlFmaXSMOGCKmHC/DWVbbB7w8eVXGBjWpqjwzz8pGAY0Qg8gxauADE?= =?us-ascii?Q?Rs44TDPH0TMDtVQYJZqNp7EMM839yRs+NMUA7BVQODkfguT7Loz+SYTmyuo4?= =?us-ascii?Q?wVqaQ5oTPPY6hzRvemm1MYtd631nfB9obzT41v4UK9vLucCUKD5T/r9O694/?= =?us-ascii?Q?79qGVrcRRZjNOpZZHntm2VT9cVWtW0FCs9sX8uClVZ+RHR0zSf+Cosl/pNsT?= =?us-ascii?Q?GEs4Ny0riwOBWafd6liXKOMu9oKQy89cbMk7ACdpoGzyArbukt93lWjeRmsH?= =?us-ascii?Q?Xgu//Qx3R5eKYSF08YScx9lGh94JqNdurWrICNMKMe+8WJLU+1jMoIiU4EDO?= =?us-ascii?Q?GJPIgngBAKrJd07ArkKhFDE76ASZVJn8wtET4qlFbkJcfdeC0g1C/GNLOfBS?= =?us-ascii?Q?YSeAxv6HuFTkyw462Wx5KABpX3yXewQEOvFrKURb4Rm/oyrFPkI5BRoCAz+k?= =?us-ascii?Q?ymrtxAaXse7mwra9NQD34cQub3ciBXj76nr9zswDmao49ce5i9+f12vISy92?= =?us-ascii?Q?beqn8v4wgsIh9RT2TA98t0Y/smgX/xRDwE2miGIvdeLqyPMUf+DWy977i4i2?= =?us-ascii?Q?0csNWCHzqs//C8tCxKD/NmpO5dMo2rWOGpINd+0zZiik7PV918mDRpvNyVU9?= =?us-ascii?Q?5ruryiX1nxpeUsw7ONeGwTn5VsZ0bDq8OD3RFENfz9sbXQ/R2666KPtngYt/?= =?us-ascii?Q?8BvGgpbEtoWOiF9eumooq7/08D3QtMNHJpKQRp/6gJ8o+w8c9E6ymw74tfo1?= =?us-ascii?Q?u2yLdifAOU9WV0mHvgbH+GoLoyPn/rI0wgHMosZ4/w+ueYJsT3GoMa8oEwen?= =?us-ascii?Q?jVoFxMaWkIKtdaJW4WudkruhtJi2lyHUY6dLvCJGBYtZtgQU9+bAVybR0skO?= =?us-ascii?Q?NC+zD3c+Xn9PcG9ckz8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8cefe659-5fb9-49d1-8bb0-08dca7d9ce09 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2024 10:01:48.9151 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /UjyIheEj+7dyo+LBiMq202TJyBjIHc2W3HKj+k2SVOmBapjmOHXco1sWlTyfwNm X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7815 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 From: Jun Yang Make sure the SG entry number doesn't overflow. Signed-off-by: Jun Yang --- drivers/dma/dpaa2/dpaa2_qdma.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c index 51affed40c..e521df8817 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma.c +++ b/drivers/dma/dpaa2/dpaa2_qdma.c @@ -615,8 +615,17 @@ dpaa2_qdma_copy_sg(void *dev_private, struct qbman_fle *fle; struct qdma_sdd *sdd; - if (unlikely(nb_src != nb_dst)) + if (unlikely(nb_src != nb_dst)) { + DPAA2_QDMA_ERR("SG entry src num(%d) != dst num(%d)", + nb_src, nb_dst); return -ENOTSUP; + } + + if (unlikely(nb_src > RTE_DPAA2_QDMA_JOB_SUBMIT_MAX)) { + DPAA2_QDMA_ERR("SG entry number(%d) > MAX(%d)", + nb_src, RTE_DPAA2_QDMA_JOB_SUBMIT_MAX); + return -EINVAL; + } memset(fd, 0, sizeof(struct qbman_fd)); -- 2.25.1