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 0CA4E45D0B for ; Fri, 15 Nov 2024 07:08:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0494742FC9; Fri, 15 Nov 2024 07:08:51 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id 3AA3D42F85 for ; Fri, 15 Nov 2024 07:08:48 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-72467c35ddeso1212263b3a.0 for ; Thu, 14 Nov 2024 22:08:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731650927; x=1732255727; 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=8NHPaotGrwiBXTEe56HhyedP8ICR/EPzv7hXuDErLzo=; b=K/9c9RdwQjE+7e0+aKFqWmriqnGuhkRWC/oG+RKt0dk8b1XDaN2sUNqvdAIkKpSV4A ow8Aw4VjHLHhI3kQDcC623yHZNYt5U01TsqIS8I0rVVQuyKiQBMOQDj/JWmS9TQYOKqd mqD55n3DpnR8NS8WaWrGx7U+YsXtV3oEuhJc+gy/QyE8AKE7v6STZl79vKMTUL9KINPT 8V0GtHdzTWceKTk7PtMvX+XQhzw/HNbqSA0o8LWtYN3r/GUP9pEIEVgR4r1WbTsJDuhv M3+fROoC4bnUmYzOdO795d8qA6kvzrix6nF5QGo4kqZJqlcgycfcj8eRgC/K6ZjDQt7p 3Bcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731650927; x=1732255727; 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=8NHPaotGrwiBXTEe56HhyedP8ICR/EPzv7hXuDErLzo=; b=tJE1K6868jx15dxxUKrneCcCe1oaaTOqWxFDp8C0DbX1wBft/BXA/tWNeG1bKWWK55 nnyH28WL12nr1JBCzudEa7ZKrahcYBb2+qY63lQ52bKDhwD0PbTBFomiqwQQ7IpCv1dD vopGqQRppJ1qbNaosH8yw+08aAgbn+5QusWshJ8AIqbLVdzTqAtb+d43T73tAQ+S1JIA dsHU78eNSqWPP210Z49bX+LcWR9SYdBowFPibXS/nGBfFf+EFVH8CmD9bHnziwiaoe37 dz6j3uKXA8ZvHwK3I8kmWbczkr+lFT7lL+0r3koXcTeLIOsaGwYu0EE14Y+sYhoEVJf5 a1mw== X-Forwarded-Encrypted: i=1; AJvYcCU7rJ2DZwB2BmbfZk16o4JIzvfN4kaHoi6GGokqswmpZJ9mYYyGxPRLq9cBRzYB1ZO/xga/8mk=@dpdk.org X-Gm-Message-State: AOJu0YwKxKUeYvUDP9MjpF8b3nBC95p072mpneKahTN0tjcw+qkrz5Te awn+5isR/xmobH17TzR4GeJxjo9DikqIFBhnuGtdmcRsLK0j0Q2S4rwI6GvwmWg= X-Google-Smtp-Source: AGHT+IG7lbna4ORYajVQWRGok1ujNwR3X7l/ghlboYd+Ms2ILB1cWsXLkgPSnvx5TclP7/HJKuzd2g== X-Received: by 2002:a17:90a:dfd0:b0:2e3:bc3e:feef with SMTP id 98e67ed59e1d1-2ea14e04b72mr2906912a91.3.1731650927347; Thu, 14 Nov 2024 22:08:47 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 22:08:46 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , sunil.kori@nxp.com, stable@dpdk.org, Hemant Agrawal , Sachin Saxena , skori@marvell.com, Nipun Gupta Subject: [PATCH 15/16] net/dpaa: fix bitmask truncation Date: Thu, 14 Nov 2024 22:05:52 -0800 Message-ID: <20241115060738.313190-16-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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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 --- 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