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 DE8B645CD8; Mon, 18 Nov 2024 19:23:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5DA442E88; Mon, 18 Nov 2024 19:22:24 +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 CBB7942D89 for ; Mon, 18 Nov 2024 19:22:15 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-7ea9739647bso15679a12.0 for ; Mon, 18 Nov 2024 10:22:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731954135; x=1732558935; 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=oPjVsAvteSa+flzzk3DpyXJJEpRFN3h3oGRagIKKBS8=; b=W93G83rYlRQyhDlAG1yq/9YJDrqjzA8p1BBarTtv9tQNf8CSt+pl+rzqTttl7NzKhF RW8i2MdxlAkNXhj9QNKgkyh0gPul+vP0GSiUbhuTkmcygsE1BZU5zmGfFQKXCh+Y9MeR O0lm1aC6+FHDpjqCIfgaRJcW3EDZcRPMsgI9hcmzAaTCCrD6xEnUbrd2wIGBcAiXMVjt h6thjIVA+fO4T19XfVJF2zSk1orO7N/8MHBXhjtgnZiYlatjpY7bd9Tgl/LRBc9yp/Dt aRy2PNQx2CqqtADrBBHEjAVw3wbMvjafAQR/FmbTYKeQ9V/8/OUnmRBKcXkgcG3o70bL UqLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731954135; x=1732558935; 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=oPjVsAvteSa+flzzk3DpyXJJEpRFN3h3oGRagIKKBS8=; b=jM7rA8qUZhvYp6q4pm6ODGh3796EkOei/C2HohfpMXAAbXSibcRI+CgNRKSJBkIKPk iUnV5GbeTCnY1Z3FYLyxwTYN9QwOFJ4s0/I92GQgHLpKRKeXb9aLI82oCxfzOml+s3EE GhMKdyEElEwh5V8KxsvAIec4NqLrsQsy5o6eCJ8LRPM2nUbSR6es/8G7z9jslJO/Kmum Uaavst9s5qdSMPHOOM9kcRi4rsRSo3SO+KDKZI4937JX4PuqvOuOBHjIKUVh9bd8GD9E yaLLwQW5I7aYIZyUZih2hEes4esPQHxGLx33dYULQisdwRFhWeldPCc9f4WudPwA9fb5 5G+w== X-Gm-Message-State: AOJu0YzJWbXnzpvS5ZFR0ufH8QDvMeMFYroEDeDjkVNauykT0j79Znwx uFQ+i4hvU4gNg6K3373KhBeTKfhYliHNtQ3xOwpILY1W6DAl3HBCPIAn5ry43noxAgWSTEyfuC3 i X-Google-Smtp-Source: AGHT+IFbb+/73UFKrua1jei0Gi62U40fhwRcBOU0Hq0XTjTQRmfnBjfOfZZ442CyEjuZ74j7TAPUHQ== X-Received: by 2002:a17:90b:4acc:b0:2ea:88d4:a0bb with SMTP id 98e67ed59e1d1-2ea88d4a45fmr4648816a91.12.1731954135082; Mon, 18 Nov 2024 10:22:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:22:14 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , sunil.kori@nxp.com, stable@dpdk.org, Hemant Agrawal Subject: [PATCH v2 15/19] net/dpaa: fix bitmask truncation Date: Mon, 18 Nov 2024 10:20:56 -0800 Message-ID: <20241118182153.87042-16-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: 5e7455931442 ("net/dpaa: support Rx queue configurations with eventdev") Cc: sunil.kori@nxp.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Hemant Agrawal --- drivers/net/dpaa/dpaa_rxtx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 247e7b92ba..05bd73becf 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -842,7 +842,7 @@ dpaa_rx_cb_atomic(void *event, /* Save active dqrr entries */ index = DQRR_PTR2IDX(dqrr); DPAA_PER_LCORE_DQRR_SIZE++; - DPAA_PER_LCORE_DQRR_HELD |= 1 << index; + DPAA_PER_LCORE_DQRR_HELD |= UINT64_C(1) << index; DPAA_PER_LCORE_DQRR_MBUF(index) = mbuf; ev->impl_opaque = index + 1; *dpaa_seqn(mbuf) = (uint32_t)index + 1; @@ -1338,13 +1338,12 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) seqn = *dpaa_seqn(mbuf); if (seqn != DPAA_INVALID_MBUF_SEQN) { index = seqn - 1; - if (DPAA_PER_LCORE_DQRR_HELD & (1 << index)) { + if (DPAA_PER_LCORE_DQRR_HELD & (UINT64_C(1) << index)) { flags[loop] = ((index & QM_EQCR_DCA_IDXMASK) << 8); flags[loop] |= QMAN_ENQUEUE_FLAG_DCA; DPAA_PER_LCORE_DQRR_SIZE--; - DPAA_PER_LCORE_DQRR_HELD &= - ~(1 << index); + DPAA_PER_LCORE_DQRR_HELD &= ~(UINT64_C(1) << index); } } -- 2.45.2