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 D027045CD8 for ; Mon, 18 Nov 2024 19:22:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92B8D42E83; Mon, 18 Nov 2024 19:22:24 +0100 (CET) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id CFA4342D8C for ; Mon, 18 Nov 2024 19:22:15 +0100 (CET) Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2ea527ae14aso7010a91.1 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=Fufe2HGUkPoPJRJTEU80LzyWJH04Lq8aqFXAZSf/lg7XNWW3ORrfO8gJKBOi3XRdNN R95b9rXk4NqPJfkn94j8cNh/YWADp3uPsqdDO7BAXubWpB+GxFlala4m6lG5OXoE2NEd /xc6XAYrT7MghqYEKDeHEiXYscys0k61Wvm1zZgugbsdnrl0gNYwtVQVg+lNaYh0gdgx 3SqcRFG11ltGH3Jlv5svzfSxo8Y6oqKsApdGISuIM45bprnNmP8Rx4V/ltCFlXV2D39J 9vFkUiEWJPP0TvEwwQ81CLnXtYe1ajMRFD3V6LewFAUfkicCF8nQ10Nrbyxzl5ijTuxD Zwtg== X-Forwarded-Encrypted: i=1; AJvYcCW14Y76y4MvvZlpPgShItW5lS2Y8PTsb3VnHVEEoDT37ZSBbP/0uo1XinOELW4NRgxC+AOAjA0=@dpdk.org X-Gm-Message-State: AOJu0YxQAC9meg1fuKpZNOf/LgT/0cnz+95c5B7CtceVpujRP0hwmv0/ Yt0YBZCIQEW63TAbuT/RdoMhNvvEmc17BG/9ROlPxWeoNiTLyGOj98k5ffZ9qm4= 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: 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 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