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 DB1DD45D0B; Fri, 15 Nov 2024 07:09:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63EA142FE1; Fri, 15 Nov 2024 07:08:08 +0100 (CET) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id D453642FA5 for ; Fri, 15 Nov 2024 07:08:02 +0100 (CET) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-71e5130832aso1094605b3a.0 for ; Thu, 14 Nov 2024 22:08:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731650882; x=1732255682; 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=lGsLxkHiJlmJXlvDSc3rWzK5/5aJG3uyOzMzPjZmVGg=; b=pvAJkFhka1xwqZPsazaL0X0Y5Rzx13JgYGJ4YM4UpIVT1+c53k30HtymMFmaXEld6L aP8y1fFK05xHseDwe5IaNYj4DbEn/SHuwYUNd9Eb36zEwWkFpdxWhvDM/0DUfKI33Xzz nfk6xo+3qDfJSoFn9xLH189EhIe+JSHgi3zsLwVUERyNDR6B+28pGOEGwN/CtFCHxt1z /EQwhKW0hmxznB8PYH1hDhmfXmQ2o6sw7UppnSQktSGreqfrXupr3DX+vsVrgCqknBJ1 F74Y7YBhrhkhSOfoi+JjDk3Mo8Uv9hQPSNaUIJCP/kih80k9UpqmxbmKdgLEHpnsRxWB Tj3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731650882; x=1732255682; 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=lGsLxkHiJlmJXlvDSc3rWzK5/5aJG3uyOzMzPjZmVGg=; b=tUAv9dn/mreuE+OnXtO64QG0BG3NALwiHi20oSf8Fr4O1hFEAXPk7HqRD8pOBA4PM/ ODCy7ro7j9Nbr5V7ZHaN9eikqO3C6nXoYCL5U0H/ubbMJ6Trs0KsU1k0m1OElm63cHhT 3/uSepiaGJlwOdM2j9A/0F6x4tr5EqUSxLffkSa55dYMApzmQwA5/UPByplyVJRxbizP Y1aqnP67MASSC/rVWn3p1un0H2sjSHqJxwQAlzQgtggtcb9QHt5PKYqqvBCiJRNCMEcv DuUwUcaqwM3c5lrEPKyyXw7uXbhPduvEiDAts03y3BkZ2IWfTbgZqT0N6HNRAVrVvnOd etFg== X-Gm-Message-State: AOJu0Ywy6C0Drg7vP7zdBu2O9AQFBqpQ6ENBD1yv0J6nsCPegAGdIDgd GGs76NCi+9Jcbt26YHVTLZw8a955dUWYGr6pRwkMSyWHDz5ZxQ0mGnGCNNFk29nrsemHqna3uo0 Z X-Google-Smtp-Source: AGHT+IEv4GI/b31Of57xDvQAtZyDG57hUZtRMj8jf2fU+xSiu5bi31y2BOxYT2Jn+r2uyKsL3akkpw== X-Received: by 2002:a17:90b:1b4b:b0:2e2:b69c:2a9 with SMTP id 98e67ed59e1d1-2ea15583bd1mr1788704a91.26.1731650882048; Thu, 14 Nov 2024 22:08:02 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea06f4856esm2123781a91.23.2024.11.14.22.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 22:08:01 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , ashish.jain@nxp.com, stable@dpdk.org, Gagandeep Singh , Hemant Agrawal , Akhil Goyal Subject: [PATCH 12/16] crypto/dpaa2_sec: fix bitmask truncation Date: Thu, 14 Nov 2024 22:05:49 -0800 Message-ID: <20241115060738.313190-13-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241115060738.313190-1-stephen@networkplumber.org> References: <20241115060738.313190-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 --- 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