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 CD5C04567F; Mon, 22 Jul 2024 13:59:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63F304029F; Mon, 22 Jul 2024 13:59:16 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012015.outbound.protection.outlook.com [52.101.66.15]) by mails.dpdk.org (Postfix) with ESMTP id 0BD7C4003C for ; Mon, 22 Jul 2024 13:59:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n89Zv8Z3By9oAwcUQyWThab5dHKt41iN+kxxi4P4k116zaaObEvELwlni2eIZ9TE+fdaunGM8UCCkfaz4odP12GUS3z1n1Id0HP+l3WrI0fJD/VHZtEjbqWNLsqImbQaAyuTj6o3QZFCSaRmPAkqJeh70/xns9EOB5sVcVbbx20gyKWAvrj+PW+YGlMrL9M2ndo2wlTZq3woYij5ccAYk+LNGSxCjYLloNvP7BBiTxl0vWh4QDhYtL1/yUcZhwOeFTqGbmuywKPcI7m1veSnjLBRpsdg/kv/EhU0Hws2NXeTrmujcyScUD/5L6XIeeaHQmuiuzyK1ru8OSR0GkWSsw== 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=R3I2CbozqdX/wxPkntlHtXmEeXPH9HZ97SnNOw5UesQ=; b=Gu5hl+LC4JIIZ9JDrsDJVqZDFeW0MnlGhovN7kB6OdiG5/FosyxZmVjcJeQ6IeqcXTFjT19WVKaPoGqJ/+Ghp7DlJxWG12f2L+XHt6HUODNt8P9fi3gO9Q85CQW1egLAM7HQlP6UqMgIe8WUL7POPsEi1rVPwj8R0SN3uSpH+x5TlTnbfoSSzwzgNrEHYto5Bjqv2Rlao6sW89M5sOczmvuDPe60QpqO1JJ+bbcMceM4vOlttHhUsX0PQntdMQQpCwMPtHLrqOMP9sa7xKUL3iJ7Klc5T2fUOT7dJ8vFNp6VhjlRO3qlnNJdGEHNMPS6n/lH7FlmiZzoZBkcTA0wSw== 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=R3I2CbozqdX/wxPkntlHtXmEeXPH9HZ97SnNOw5UesQ=; b=Qf8DKxvr+eY/neGrkJd/iwgbbFMBXceAqgWnexULsqGC6qOJ4yzf6gGOyPQ0UYf3WuMC8Ofa/v1YdHxDd2xttVWaa5sOvgovfhEnba89cYs+0cT5+3kk3XdDl94eXCS2yemhfMQLF2q3xnizXw/cesah+7DEDYPVONjAyFtwim8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Mon, 22 Jul 2024 11:59:09 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:09 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v2 05/30] dma/dpaa2: add sanity check for SG entry Date: Mon, 22 Jul 2024 17:28:18 +0530 Message-Id: <20240722115843.1830105-6-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|AM8PR04MB7970:EE_ X-MS-Office365-Filtering-Correlation-Id: 16843711-f975-45ee-a706-08dcaa45b1d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3m+BR3PGcQaV1Ma4+3ao/usSjZMOrDc5TA/AnvlrPoBHseJOJavm2bFeVPpn?= =?us-ascii?Q?4GJjgx6cFY9UElgyrTUEerOe/eSokrIBoyD8VMF7YilvOK0Tl63TPvaa0wqQ?= =?us-ascii?Q?TPf5Lv1V6Rd8bDfd9w4thPKEioDMJSqpB/raeeB0StUH2aty0H6XNN4ciUFs?= =?us-ascii?Q?wjrypR0udyQpu3Cmwxrxdy9/BTTSQG9as4FYhx7M5CpwDz+DvRsQDACLcSBX?= =?us-ascii?Q?KFf2A4egfyS74HJjapMwzhbcnWt0cBlurhAXAdG7a2w5RphrjeO9oLrRWL7t?= =?us-ascii?Q?IJE1tg4SuQ2HgamKsCZX9hC9i/B4FwGg4ACmto0eX20hVk/5TX7ctb/HulG+?= =?us-ascii?Q?wrnrsJolT85++wa94snjFDGL6bRf0Cp1ICjaE1Om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2ilTOQIrrnCfDx8v4KEbX6DVZQkYkNG6d3o8TvXwUSFTx6HXWphjxVnoGaKp?= =?us-ascii?Q?ho79dU5vRC5XYuMMwu4pPYveNiYZe3uPBdSxQpubNL7ZiNkA5rBeLUobsuie?= =?us-ascii?Q?hRGS+/pUY5PO3J0t3R54EcfNYWxhtiTtCkKJIrpFbTrEojZNBA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WZExKutP7E4qB2JTtJYoaXo+UCsl9LBdqIUYgUJPfok3OfH1pI7TGRM15BKh?= =?us-ascii?Q?siV2fCPwkyeNCYeFUKg09OQxVsUQtJ05FbsEu23ooen2FuqjH04l0mQMqrfk?= =?us-ascii?Q?pnLiU6kpxwejbtZGv3HsfCvUQYnpbqWiCHIixbVJVAwXUX1TXUSwMWVIC41W?= =?us-ascii?Q?EYiaUJKJvXkUrZ4gw4TF27wl5Ve3ktNYhkTGdqeKkIL9Lv+tGQsXg5yTEvz2?= =?us-ascii?Q?ZqXc09nKKd/ueecPsAHYTVswih1ORw3uIFHveQWJokMrz/9kOSS1XxEKOs5W?= =?us-ascii?Q?y6RREyNzY5ES9WBK61G9CJGpZ7Fd2C1ISlC0f+9FC9EH02R3oraq/n/D8e0n?= =?us-ascii?Q?Yu5QtXrEdaViIcd8F8/gs+kLSmfSaqJiwteVflIfHkTAAcRJdhUpiLvQdjl2?= =?us-ascii?Q?Sb/D8WUMz7jy86lBzOCJevHaZMOfSMI2HjiyUqu6DFGnNB+Xk6rgjAjACnZT?= =?us-ascii?Q?G2sD8qO7jetVCUU//5naepquCMm/vvUE0Hg2AKDJs9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SaB/Lg/zbzFOSkV0wxSvfulEdZRX6y5YETyz?= =?us-ascii?Q?QaF21ghXBZsGSmp0puoLArNV2gUgxPvPX8tK4Bjo/abkC/UpYIOBKlskgeDD?= =?us-ascii?Q?CdKiJ5q33M1zhRiwb5LgoMku03az0KTbNyZhHCqagpYp51jW472pFRPoxtwD?= =?us-ascii?Q?o8wFf9nL42yhUYF8c1Wm8fTJTbe0xDmsSW0IHiln?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16843711-f975-45ee-a706-08dcaa45b1d1 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:09.6969 (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: 5ZfKwMVNJerBCDzVOXJMpbJhrqPmr7XT/D8HZ4nVc+dkpypVDtrCF3DiQlOpv4yR X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7970 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 44b82c139e..7f6ebcb46b 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