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 C938245683; Mon, 22 Jul 2024 18:40:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9DBB40BA2; Mon, 22 Jul 2024 18:39:57 +0200 (CEST) Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011067.outbound.protection.outlook.com [52.101.65.67]) by mails.dpdk.org (Postfix) with ESMTP id 901BC40DD0 for ; Mon, 22 Jul 2024 18:39:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NYbJpcWN2OjnJkJDJsyYwjtkZbQmbIveXNfI7cg3aCHL2WsHu5fQ2ehS1OLRE3OqEFrmZq/O5dslxSMqBSWxqLIXjbb1lxV04v3e1WBw3/GTUc9Zhg+zvKXnoNFQnuDUvnHs5FnJJB9p8A+Bh97P81U13pEzzmuuY+MEwglN81ltDbPdKByzqEYvl8HsmWOx7INmK46LerTJiB0zkQT9nYrUOEaiim6/fguGV7Cm3STaPNjCE06aVKG36Gg+mf4tavkjLIWU/uHr72o4XWgShoSTn6Trvc6ZQww4KR0VqO+ACtG0xsIqqnDRwEbYKCRNTIMeOyBdZbSHj/XTN0ESbQ== 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=lCOtPe2q3EZJ95yTFSgl8nV3qvSKWt7lxRt3+n+iky8Bmqtrqp5b1yD3X3ubDz4dV956FXvRXQFk4p9g8RdHF3mdUq0oLlk4KjevBwl9CNLGFKJH8NGX/hIVuacAmCRQOQcg0R7rZs1cK9MDs9Ts622QaCkGQsASGxAHO+g1XcKfZmbrqr4zbQssAyjTSNkQKiv6r+lvJa1gDH7/OKR3sGAnAbr87bYJbb10KOeOOhTPoQrLg1Xcdv1MbMVJ1xhuvDFptZalzTHhhkpQhpGATNgneiftRQUSfp4qBuXhRlOQLBOSsVemrHfgyvCqYJruuXubkI6e0t2HaYA7pELrfw== 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=D4xGvj80whKaZ52nqMLqEekfBu+iTMNxVOdhEu86zF/Oi/7gpnyz7VHpWnaTwngqvx7qCWyESrACUYxlRSUBXqZf9oXErnIgihMmsCpWFskUMHbHrUXU1da+TkOB20yYZOjnHwd2jIFrhWS8fz8w3yYcueCO2bQXPhysD0pIHok= 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 VI1PR04MB6798.eurprd04.prod.outlook.com (2603:10a6:803:131::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Mon, 22 Jul 2024 16:39:54 +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 16:39:54 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v3 05/30] dma/dpaa2: add sanity check for SG entry Date: Mon, 22 Jul 2024 22:09:05 +0530 Message-Id: <20240722163930.2171568-6-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722163930.2171568-1-g.singh@nxp.com> References: <20240722115843.1830105-1-g.singh@nxp.com> <20240722163930.2171568-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG3P274CA0014.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::26) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|VI1PR04MB6798:EE_ X-MS-Office365-Filtering-Correlation-Id: 78256043-cca5-497e-5016-08dcaa6cea18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?I6auqe77UdlOSojiXDxbohhaYpxHYFWGs0is4VjSZ0/nE/rgiEsQD7uDRGC6?= =?us-ascii?Q?AioAg9bkzk2gpVp4kiycLVz1MrjpDz53+5hFo/TpHPF+AI0yZEdypWYgQfKT?= =?us-ascii?Q?nf6dA6RFwwbI6+GSrKvt0TIGQcSUAdR42VtulYvDXE9Kzx4RG5LP+uffuoOx?= =?us-ascii?Q?CKfdE3tqt6vJpSPOuOUHh21PFX4J1Dk/CQPvCCYJrq5CSLH5seyzuXudvApy?= =?us-ascii?Q?j2s6MkI8zZokqKOMrRqhFEGi3WiLUNEFQwqJsuxPiMDuGDMIlFsIwrC/19LA?= =?us-ascii?Q?8YwbdG2WMw7OzL7qU3EUf4TasVaxsxTFgpiaEfooZXdG/L9YlElIytyCaPHE?= =?us-ascii?Q?kOCIXla9p731iChdm0BYSBldIdv4Cl80Rzdn3543NpYlSb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Vk0cTlnCKKQwwfigq5IJK6UoQ3H2amzVOigU6RHxouLIZX?= =?us-ascii?Q?G0Aoa1FrUjAs6Xm5nWIg8+EF/NmoNi/yzUp5DahjdDOzLFYKX709cwVDTfaB?= =?us-ascii?Q?jMqt4nidIsabwxPf+31TN8gwGlXPP+EHhdNzyzxauTquoTVP+A=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)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WGZKEbEAdW3Pz4I8FyhL3a6aHTbJuB8QhZmkiNNQ7j7SBehqcRw/ziX895K1?= =?us-ascii?Q?w0Rd3fsOSsjdXOnlpif7kV/c5fZligOv6uIeZyV1Ys2fb1a17nkiJgUUPGtX?= =?us-ascii?Q?J0OysTPhOx7cQY0OexP9DwWueFtAhETOznJE9QG8xfaAqwTRT9K7dkZpqPLg?= =?us-ascii?Q?z/0XK5uXuDO1VCo6y4clERdwAYe1Mhf9HoCQUvzb6RbVWvYCl3ibF0W5R/c4?= =?us-ascii?Q?tvWkNVyZYHGya5yRtKZ61xgptdPqpiWe7T+DWXXT7d7nsH78iiC+GrXC/tNI?= =?us-ascii?Q?mwJtn2ZbirjCQEW++dI87SOmgSmfwQbkItTWrtbV9Fs8xqqzM9ejGPjPxqov?= =?us-ascii?Q?ezuVfE3QoOWv/i7mXGlD84U1dv42cW8S83TQlgHP4l80CD7PoapDuKGnUTRG?= =?us-ascii?Q?YMI0Je0gL7cMNubEvMqvbtMPGR4k8B3PgB1/wNxp0a3CGcZmDzxJxaUJO7an?= =?us-ascii?Q?9/f9AURz6qJO8gZ4PDL17wrb1gLMNcv82/0offTqW/Mt5KN65cNLHhPbOuf+?= =?us-ascii?Q?6unioU5Ef0MZeQ1mCpmv5wniDZI6PhBr/iTVq0toxirdr8EP7h5E0uXvxWIO?= =?us-ascii?Q?S7scljdTxZxjkUOvLvA3+fkfxvBXbMHf5BqfZg7IAawn9re73MuTITvgC4LT?= =?us-ascii?Q?uMLCAfoaMrOH1wS/+EhheGa5Suzim88YpJLh363CDfhIGSEaSafA5iLM80Ho?= =?us-ascii?Q?Kj34ZlUfCt4kUO0C8NYDsHa2aiXoSXJxLNQLQqngdKDOoMgQrq+O6RIAuBEa?= =?us-ascii?Q?WE3sf8CJi1j9AqLUn35n18mJkacyhrkIiorXqNqTtr7L/IVh5CPZ+u4wJafJ?= =?us-ascii?Q?N1+ybkUGSvAv+lSuJ2RklO2JM+KZOc5tP63oMbqEp3lw/Xocg+XymvabKXci?= =?us-ascii?Q?w4v4+HokslzLSwHempNcS157wAGyQPPOydA52WrXBJiW/gyWA6No9UioRALs?= =?us-ascii?Q?9lKvSyICQMo6f9YZeEeaFYfdZYdUkn1U82yoAb5HOuP8KpEVRVkSi7nWlfPa?= =?us-ascii?Q?R0grL+ftsgF2jD92nYZdJ0nwbz3m506JuoOsfthWdTRpzBuAkmQtlw2/+Xcd?= =?us-ascii?Q?39XnMZKCDNoL0IWX44NkZUNQxK1r3Xap8U3eHGm7qUkvJ1r6nuYHnMtQ4s/j?= =?us-ascii?Q?toO23jn+Q4cUrq7YSfw4qqSLLwym4xbMp375QrHidWptQ1S4FIWUYGXSPzE0?= =?us-ascii?Q?Uri/aGEfOOW0MiBtVpCz20AZbZwmmcPgLAe4chKhvUVoczqi4EPSFF+35V3y?= =?us-ascii?Q?9iNjp7xxrKqZu4EXCE9sKKz1KiNJWdYp2PcQHwVEm0vPDuT11gFfMXZollVa?= =?us-ascii?Q?UZtTtkXjg0umdSchOniKoRdIAjQf0kp44mI6QXYXnxeWV1GxaumnNIXGYjcE?= =?us-ascii?Q?IqUWGHTXuMDu+tJ/qKIec3bfOIsNerMZiFpesRdMubz+YtnCEYOpKzU82Edl?= =?us-ascii?Q?U7wFG+A9B2qnLAijvABUc/lJOWZvCUQ1ws3i2C4oHwXwWfxJ868vpGs/c8jZ?= =?us-ascii?Q?pjNIXFEHgScFkPRGbdM4ZIB5i8vRllDF9L8TQIn/VzB1wutURPYQLVxlifPl?= =?us-ascii?Q?T5FC8xHxx5nnRCIOitMYrXoaP5rSHZIwjoCbOXJu?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78256043-cca5-497e-5016-08dcaa6cea18 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 16:39:54.3184 (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: wAVER2D30tY/jcMT0WBohcKNaMB/pWs5iQ6ghmeDGU58/TnwaU+mNvDhxwPOUR17 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6798 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