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 0100C45CD8 for ; Mon, 18 Nov 2024 19:22:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C29E542EF0; Mon, 18 Nov 2024 19:22:25 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id B1BDA42D2B for ; Mon, 18 Nov 2024 19:22:16 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2ea568d8216so1304116a91.1 for ; Mon, 18 Nov 2024 10:22:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731954136; x=1732558936; 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=FetX8cMsVU6thAoFJcY6uUwz4bEBTm7UUsySyb6wHvk=; b=X9ScUcKpnGWCGctQCCI7tmU/TkSIOeTuyj9V2A/v2eHaqVi1LEeui0PsHeoSFTWE9k Y9M/i/Ml9Wr+JHD6P8HJMv8LHufXj0TRTQs0KpdjKQ/L/NF6OeD+9PNHncSOogl04JU1 2F8fXSPJH/ESdBRJVpybNXN22bgIDrCPOxxqiRNyTVJFmITBvE4oLZRA6KZqHWteJHQM cPbrf3MT9ELE01YylB8TGIcg4MdnBFA75o32/F14kbxRsR/Tdxs6CLA3teKFUTWaTPyq 4iEIFz1FZarKlcS63G2/HXqCNFstzOW/AqTtYc1EcsfHwg9/pKUqIHNGRrWuWQY2FIeF JIMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731954136; x=1732558936; 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=FetX8cMsVU6thAoFJcY6uUwz4bEBTm7UUsySyb6wHvk=; b=lWx4aZ+mWW4199UYIREnmddZvywJAdWOTdxEzKZJht685aejECcEA0MHobH2cOd687 wTn0CJKpCqk9FCbDxlEB25/Bt2oCGNqvN2UlR7BRuo2QCZBOsdhpXFck0jmx/Rn0nKsJ O9WzzdN6x1pUBY462KqL26hGWZUbxXRQt9vQ6wUqrzU6WMVzZVrDfXgIAhqOqWjtftFf AoOmSLW1WJKe1QoVdz93gt10skIsq9vsLWNYsGTFGDt3n0yxrjlDJOYSf7XWgOW9PjHw yyRHoIoy+JkazS7DRZsWUAbs72SSUkN3IkAd1mIkXgKlHb4hMuQ3TtGsE0GEM4zxKTXj 6adw== X-Forwarded-Encrypted: i=1; AJvYcCX9bgh3eH6CoA6bRNU0/n4HM7S0Z6kFYrIosk9RfRxWup/afLJDO+xlcjK8euVX1Q4ZWf4Jwt0=@dpdk.org X-Gm-Message-State: AOJu0Yxw6c+NubifKEHzmfL+vnwlAnQY7kqDjTwTc9iGQInoL7zdnLJ8 lvaaB2q0oKBXGhE8SHWMFBI54xlIWmlJ/RhtP/quWVJXC5JiAbVh+kB15TDyJkw= X-Google-Smtp-Source: AGHT+IHhIizpSMRuy07r4IEBI0RRPTnhVsOY8EPXIkvGr6e9+XbXSwLCoUBFztDfgjRlr6dUe5ngQQ== X-Received: by 2002:a17:90b:3e85:b0:2ea:9bc3:7ead with SMTP id 98e67ed59e1d1-2ea9bc3837bmr2087224a91.18.1731954135938; 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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 10:22:15 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , nipun.gupta@nxp.com, stable@dpdk.org, Hemant Agrawal Subject: [PATCH v2 16/19] net/dpaa2: fix bitmask truncation Date: Mon, 18 Nov 2024 10:20:57 -0800 Message-ID: <20241118182153.87042-17-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: 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: 2d3788631862 ("net/dpaa2: support atomic queues") Cc: nipun.gupta@nxp.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Acked-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_rxtx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index e3b6c7e460..e253bccecd 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -933,7 +933,7 @@ dpaa2_dev_process_atomic_event(struct qbman_swp *swp __rte_unused, dqrr_index = qbman_get_dqrr_idx(dq); *dpaa2_seqn(ev->mbuf) = dqrr_index + 1; 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) = ev->mbuf; } @@ -1317,7 +1317,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) flags[loop] = 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_seqn(*bufs) = DPAA2_INVALID_MBUF_SEQN; } @@ -1575,7 +1575,7 @@ dpaa2_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; } -- 2.45.2