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 8A7EF45D30; Mon, 18 Nov 2024 08:03:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB93B40A70; Mon, 18 Nov 2024 08:03:36 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by mails.dpdk.org (Postfix) with ESMTP id D9EF14029C; Mon, 18 Nov 2024 08:03:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T6XbzzJSozfdZPBOFhswGDKdm4k2sc2l196wBfUtUkPpOL0KMgsVu1LsAV68/Tw6lHF4tMPdp6qJpLpN5yuhpCgUdGrsjQqpQpuBkuso3NUc8wk/5IcQJ6IR350l8CJeLs29S6/Em19Dp+2W0mqJwdxKCPLS8d/LpbT90b6BWDO/S5ZFimjorpSbCIwVDP0aYtiiA6Mz5iVsmFfG4/+wCsA0J8IXvFGMf3kSmXF2TDWg1Sru/yo4aqnCy38gIKuWRiY6+Lhyg1jv5lQ0WclBQLnQDF5ZK6TwDAxFtnKqsgL/Suqqs75FnZFjO3w5y6hO4KhHan1UJMRkWPCO7DN1OQ== 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=5+mcA2O5qCiG5ozUN2qgjC7s7B8GjDJhpLVrFzGv1WI=; b=zVwPpkn5jRp/UlXEi0R6qmPhi+7FZpHg7B9PL6kjdmQ7ni9dR0WOlaZeC4miLiZJODYmVESdlTeThA6apUAy8X0AEthpdaus1RdVaCKxKVMvgXSbF2vtqxtd/ff/0wzaWqC7jBr8Jzde6EoMQkZ6BqtbqhZAsdRCykr2Ij78Dr1+JwGcSycP59OayoUw0mHxuxCq7UFxeTP+tVNLMFr/bhWuxswMGhJi1Xm7NPi/gQbP/jSsvwO2WeKKxMLzY4IIlue3iHvq0w4Wjzi1wjWpdm1dZ82zIff1u1IgPbNz0RgCkFuHaCPCmzY5c1gG9WUG0Ieka/SarvwbCu2RRjaEyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5+mcA2O5qCiG5ozUN2qgjC7s7B8GjDJhpLVrFzGv1WI=; b=OwMbCyA2JLcUA2W59RFsrPlapZ9Y5oGh/J8c/gtWJoByzCKvje6CnwrJbCFXa+ff+qUkPjFTNLfyu6jiQJXk+oFkn4+OKN+vjAFC7gHD857YFSRnrdMpxvKY0tm6fl6BlG6tDC2HyUeS1GRw31jcs+f9fSG6NtJnl8K1aJiInnBPpF4v8oSYEaidwIsDc4Ea/0FLxJISVrqYJNj++4JJPlaK5GnjYpYF4wj5qnNUG1ULbexiU5NLvFlxvH0Poyb2hSU7vizKUH0q3Q1haP4fDuup0ZgUm9kkrFuZ2MEaLqzr0RnR0nrKKd+2fremBXwh59F9jX11i2KaG7eICAroxA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by PA1PR04MB10441.eurprd04.prod.outlook.com (2603:10a6:102:447::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.22; Mon, 18 Nov 2024 07:03:33 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%5]) with mapi id 15.20.8158.019; Mon, 18 Nov 2024 07:03:32 +0000 Message-ID: Date: Mon, 18 Nov 2024 12:33:25 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 12/16] crypto/dpaa2_sec: fix bitmask truncation Content-Language: en-US To: Stephen Hemminger , dev@dpdk.org Cc: ashish.jain@nxp.com, stable@dpdk.org, Gagandeep Singh , Hemant Agrawal , Akhil Goyal References: <20241115060738.313190-1-stephen@networkplumber.org> <20241115060738.313190-13-stephen@networkplumber.org> From: Hemant Agrawal In-Reply-To: <20241115060738.313190-13-stephen@networkplumber.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SG2PR04CA0160.apcprd04.prod.outlook.com (2603:1096:4::22) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|PA1PR04MB10441:EE_ X-MS-Office365-Filtering-Correlation-Id: 5512d7b4-1d30-4ec4-4b73-08dd079f1d0d X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?B?WEJWU2tpNzVUOGlTeTJGZ2cycHpBRUJJRS9ad3Rld0pPNTg4ZG1BWXhacFA4?= =?utf-8?B?ZjRxR0lDeDU4NHVKcHRZQy9HaHhoamZBNjQ0TjJiWXZ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wTjdxczRPemRzWTYzWG9GZmpocjd6?= =?utf-8?B?OFA5ZXU3VEJrVHF6ZzFNa2Fpenc1ZDlvbjR0dVExZE1SeDMzSHA2TG5QY1J2?= =?utf-8?B?WEwzMTduazNURnRLL2Frb0htNFcwcXY3cWhUTmVYTjRJYm1hMVJiTXAraFpa?= =?utf-8?B?K1FrckY4enQvQlNkTG9aek9TdHR4ZFZIUUZkUGxFeXBXS2VnNytkbms5Vmox?= =?utf-8?B?R1FJQ2dKeTRFenUrdzJJTVlHOUxraitKYVRIQ3NiZGU4NUlxN21PNXBwQ0RN?= =?utf-8?B?aG8rUTlSdzZ4MDdWRmlPMFJmTGs2cWFNRjF0dG5LWnJqMWFoQmlNTmI3SHpt?= =?utf-8?B?eXZ2clJ3UENrWWFpc3p4QjljbWhsckduc3dnYU83c04wMXdYSU9scUlhVUtm?= =?utf-8?B?UnlMN3Y5YVM3U0VIUmpYOFVlbGszNUpOMjRsVkNMN0svYzlwaFIyM2VjOFVI?= =?utf-8?B?ODVuQTNBaXUzTWhuSjBNY1JRU1JxZlZIM1Y0THlWVHJzSFJPMXR4bmxURmJI?= =?utf-8?B?THBjd2MvNXEzYzJ1VytBZFRIRDUwT3FpZ0ppSWt5UThXSmlmSS84U1UrOWp0?= =?utf-8?B?MUJNa3RJaGVKbFBncXVmeWUxaGx2aEJvaEFDN3NjWnNYd2hUVy8vWkpVZ3NM?= =?utf-8?B?TFRxbm5UZTd3QXNHRG5NaDB6SHRndWdnY2lYamlsY0h1anFBZ2orak9IeW9z?= =?utf-8?Q?9YhgNmZYqIJrBbimN191?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-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RIRUJRVzIyZisxeU9nQ0dUYWRad3Y3?= =?utf-8?B?MWxVVVVJWklpdnd1RnNna1dSKzRKVlZ1cHBmWDVWbWpwS3JFUjdHc0dmK0ln?= =?utf-8?B?S3BvcnNLUlV3T3lNTU1vTGNldkVQd0lLc01oejEzYVBqU0loeWJLamdHYVlC?= =?utf-8?B?TVJQRXJtNGp3MzMxeHIyZE9TR2xKWmpQbnpVMzBwS0V2ck1qdmdrY1U5bWhr?= =?utf-8?B?RXk1andoOVJKc3hpaEJRS2J2QTNkZ1lkcExBNzNSck5iZ1ViWWFobU83MGpi?= =?utf-8?B?eWMwTm5hNVZxQ2JIRDdXMGNUWFQ1YTA5QlVBVXk5SVk0WkZiMGdISVcwRmtF?= =?utf-8?B?NW5yNjRrWGRUb2pmRVdET1JDRW81cS9HZzFuWWRFOGh3aUFta1h0NkZOaE1x?= =?utf-8?B?eWc9PQ==?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5512d7b4-1d30-4ec4-4b73-08dd079f1d0d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2024 07:03:32.9207 (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: v4aimRIYCBh9tI+PxP03dPIQCEak3xxm1SfyBam363fWS7BMHnUEnEZe15yRNkKwU/4hY0gUnGXhb2sWHrHmow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10441 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 On 15-11-2024 11:35, Stephen Hemminger wrote: > The dqrr_held mask is 64 bit but updates were getting truncated > because 1 is of type int (32 bit) and the result shift of int is of > type int (32 bit); therefore any value >= 32 would get truncated. > > Link: https://pvs-studio.com/en/blog/posts/cpp/1183/ > > Fixes: a77db24643b7 ("crypto/dpaa2_sec: support atomic queues") > Cc: ashish.jain@nxp.com > Cc: stable@dpdk.org > > Signed-off-by: Stephen Hemminger > --- > drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c > index ec6577f64c..7ad8fd47dd 100644 > --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c > +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c > @@ -1491,8 +1491,8 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, > if (*dpaa2_seqn((*ops)->sym->m_src)) { > if (*dpaa2_seqn((*ops)->sym->m_src) & QBMAN_ENQUEUE_FLAG_DCA) { > DPAA2_PER_LCORE_DQRR_SIZE--; > - DPAA2_PER_LCORE_DQRR_HELD &= ~(1 << > - *dpaa2_seqn((*ops)->sym->m_src) & > + DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << > + *dpaa2_seqn((*ops)->sym->m_src) & > QBMAN_EQCR_DCA_IDXMASK); > } > flags[loop] = *dpaa2_seqn((*ops)->sym->m_src); > @@ -1772,7 +1772,7 @@ dpaa2_sec_set_enqueue_descriptor(struct dpaa2_queue *dpaa2_q, > dq_idx = *dpaa2_seqn(m) - 1; > qbman_eq_desc_set_dca(eqdesc, 1, dq_idx, 0); > DPAA2_PER_LCORE_DQRR_SIZE--; > - DPAA2_PER_LCORE_DQRR_HELD &= ~(1 << dq_idx); > + DPAA2_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << dq_idx); > } > *dpaa2_seqn(m) = DPAA2_INVALID_MBUF_SEQN; > } > @@ -4055,7 +4055,7 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, > dqrr_index = qbman_get_dqrr_idx(dq); > *dpaa2_seqn(crypto_op->sym->m_src) = QBMAN_ENQUEUE_FLAG_DCA | dqrr_index; > DPAA2_PER_LCORE_DQRR_SIZE++; > - DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index; > + DPAA2_PER_LCORE_DQRR_HELD |= UINT64_C(1) << dqrr_index; > DPAA2_PER_LCORE_DQRR_MBUF(dqrr_index) = crypto_op->sym->m_src; > ev->event_ptr = crypto_op; > } Acked-by: Hemant Agrawal