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 86E6945CD8; Mon, 18 Nov 2024 19:23:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 52D7142E53; Mon, 18 Nov 2024 19:22:21 +0100 (CET) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mails.dpdk.org (Postfix) with ESMTP id EC43642D0C for ; Mon, 18 Nov 2024 19:22:12 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-7edb6879196so3278149a12.3 for ; Mon, 18 Nov 2024 10:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731954132; x=1732558932; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b25SRfcPJGEL6gf7LSOecJCDbLp4sPNTpJjKMzdA4IM=; b=lKNKgD5kemwAErbv+v+7NirWkaZqY89rK3EVu/2jiuvLjpwr+ljfj8FCgcgufll/3C 3ucpqLZnhy5BvBMg4pQoMRJkkYZ7mbuTLvE3f16s/pl83ys1Rnw2UkfYcMJPJxOmYtUV gE2xVrLWFwzD3fQRpxK7PcLrWKWrE6FJw9ZIq2r3NMF9rHtfFCjMyo0jmkvx5HJLJ62+ dsAhY5JMHRjZ/HWpWcMR4zk1K0Ld0jRNnxJl8GKnjlyvKQPLonbGdqhEAWbk3bZemKJp Z0LAKi9/mgXQZfrBTHhMOEYSXJLFsK6iE4DXtKmFPjJApTsFDTbI++BelFZOkDsV2pLX pdxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731954132; x=1732558932; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b25SRfcPJGEL6gf7LSOecJCDbLp4sPNTpJjKMzdA4IM=; b=ZLdtE5qnvPCBugxFCvt8XzSV8EtxB9qJ3BT1nYW2zi1WFwHqv57JtSxtTvL0xnAQol dOCEg3pbakyCjLjwAwOEFkXOUfSExYRIIBQtPsKGOo8kkN6VvVcS6cRGX/Sn6hGTAc+F GZOQEx+jXFUe4fx04Qk6ekw5qjWL4cDSk/p1sRaxzgjtqPLSXMGh2FbnQtP/lRHtm70K sExHOWBW3rQOkmntkpVSy3nxTlJSgYuw16b0mC3yJNb0btIGmbcwTtf1+3fOiLmMhzjc rjz1uL8/4UG0q5DuxCAf+1xXJHnKneXgjDpj4qPyhfW41ZVSIb/9XWZVPYczWRxwKwQJ MnEg== X-Gm-Message-State: AOJu0Yy4zSWM6dmYaKLVQnJ9iaTIn3FHXVZMdThxcVm8+s7J7h6nd0pD MyPAh8msiSRnKbclPi4SZYYpRrCdDMF2+4CIbgxqk33dlMlnaJHMXT58Fn6K6EHVTWcX7r3q/lD B X-Google-Smtp-Source: AGHT+IEyBEKWzZAnC1Dl+Sjk38PpFkf563YILm5PnqcIjg3gSp+4Df/uMlverIgy5sDQ+n/4GMTp9A== X-Received: by 2002:a17:90b:1a90:b0:2ea:61de:38ef with SMTP id 98e67ed59e1d1-2ea61de3cc3mr6202666a91.28.1731954132134; Mon, 18 Nov 2024 10:22:12 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea61869bb2sm2916724a91.12.2024.11.18.10.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:22:11 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , ashish.jain@nxp.com, stable@dpdk.org, Hemant Agrawal Subject: [PATCH v2 12/19] crypto/dpaa2_sec: fix bitmask truncation Date: Mon, 18 Nov 2024 10:20:53 -0800 Message-ID: <20241118182153.87042-13-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118182153.87042-1-stephen@networkplumber.org> References: <20241115060738.313190-1-stephen@networkplumber.org> <20241118182153.87042-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 Acked-by: Hemant Agrawal --- 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; } -- 2.45.2