From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E784E7E360 for ; Fri, 3 Apr 2026 10:00:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C1FA860882; Fri, 3 Apr 2026 10:00:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1bGF3dsUjQh7; Fri, 3 Apr 2026 10:00:42 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3776F6083C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1775210442; bh=/p5XixUxCC27uL4fhvJqLess3RgiwpsA47qI4D+6Ayk=; h=Date:From:To:Cc:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=w+810a54O28pwyiGyT+lihtIpfVd1r4lrW5tpj3sfzB41mtffH/5oX7/ZmGWY6mr0 RhsNhMMKubzpmpfws5YZWBMoREr91wJ4HVbifpyb3NX0A0j3puFe9dZ7IY8I5nDe9M L8tHHaT5z/fhVyH1w+oM5phAtZAPcBX7voeNR0JaPVqL/zBR0vWTmqsQzP8T8vcyjz CV6nhdOIWSPXd2OhTmE3iBtOH8EVVy8aEhqWqyEFlDXhD6lHqRySNE3lTHx1MtEMLw 8LLRS/fw97M3bqdKQkdPSGlqkeawLrs/dysMvYPZsyf4iTZnbqq2tOKJvdnBwxhiwY dwDfXnXXmP9cQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 3776F6083C; Fri, 3 Apr 2026 10:00:42 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists1.osuosl.org (Postfix) with ESMTP id 039621A9 for ; Fri, 3 Apr 2026 10:00:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DD4EE40AF2 for ; Fri, 3 Apr 2026 10:00:39 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id tK7ppjtBU7Qz for ; Fri, 3 Apr 2026 10:00:39 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::335; helo=mail-wm1-x335.google.com; envelope-from=david.laight.linux@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org C7EB240ACA DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C7EB240ACA Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by smtp4.osuosl.org (Postfix) with ESMTPS id C7EB240ACA for ; Fri, 3 Apr 2026 10:00:38 +0000 (UTC) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-486fd3a577eso15542375e9.1 for ; Fri, 03 Apr 2026 03:00:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775210436; x=1775815236; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/p5X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b1804b1-488997a51b2mr37684005e9.22.1775210436221; Fri, 03 Apr 2026 03:00:36 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48899d1b12bsm20958925e9.5.2026.04.03.03.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 03:00:35 -0700 (PDT) Date: Fri, 3 Apr 2026 11:00:34 +0100 From: David Laight To: Aleksandr Loktionov Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, netdev@vger.kernel.org Message-ID: <20260403110034.6fe45f70@pumpkin> In-Reply-To: <20260327073046.134085-10-aleksandr.loktionov@intel.com> References: <20260327073046.134085-1-aleksandr.loktionov@intel.com> <20260327073046.134085-10-aleksandr.loktionov@intel.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775210436; x=1775815236; darn=lists.osuosl.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=/p5XixUxCC27uL4fhvJqLess3RgiwpsA47qI4D+6Ayk=; b=UFQ5QZjls0tUSR9uQ305kM2T54c8Y2gAsd8xG4df2yfmPpYGdFHQTVAsBKZbfi1rjc nO8jrIyv1UfpBbB0xDEGgCIx47N5N4iTiygIeJRVd4qKEaT+Ec5dzEQuLxaA1VySVHaE gEFa6hhvy7lsbjvcybxQnZvHRRHHfxfFQQ3RQrcLET+kQ55tmO7yYRff2ndW2U8U0OUn iWCy/DIU8u1xAXB2p1QGGHzFmzLXc0ssfSnXm/AEBWgkAWKTToImwlS8b8ycdYq9uQgN alvsEakMJn8W12JLZhl0/2ory5qWJTddlXPwgJm6MBHoI6lKFeiQa3RdnYui7DHkp/kE Hg1g== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=UFQ5QZjl Subject: Re: [Intel-wired-lan] [PATCH iwl-next] ixgbe: fix integer overflow and wrong bit position in ixgbe_validate_rtr() X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Fri, 27 Mar 2026 08:30:44 +0100 Aleksandr Loktionov wrote: > Two bugs in the same loop in ixgbe_validate_rtr(): > > 1. When extracting 3-bit traffic class values from the IXGBE_RTRUP2TC > register the shifted value was assigned directly to a u8, silently > truncating any bits above bit 7. Mask with IXGBE_RTRUP2TC_UP_MASK > before the assignment so only the intended 3 bits are kept. > > 2. When clearing an out-of-bounds entry the mask was always shifted by > the fixed constant IXGBE_RTRUP2TC_UP_SHIFT (== 3), regardless of > which loop iteration was being processed. This means only the entry > at bit position 3 was ever cleared; entries at bit positions 0, 6, 9, > ..., 21 were left unreset. Use i * IXGBE_RTRUP2TC_UP_SHIFT to target > the correct field for each iteration. > > Also replace the hardcoded 0x7 literal with the IXGBE_RTRUP2TC_UP_MASK > constant for consistency with other parts of the driver. > > Signed-off-by: Aleksandr Loktionov > --- > drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > index 9aec66c..53b82a5 100644 > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > @@ -9798,11 +9798,12 @@ static void ixgbe_validate_rtr(struct ixgbe_adapter *adapter, u8 tc) > rsave = reg; > > for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { > - u8 up2tc = reg >> (i * IXGBE_RTRUP2TC_UP_SHIFT); > + u8 up2tc = IXGBE_RTRUP2TC_UP_MASK & > + (reg >> (i * IXGBE_RTRUP2TC_UP_SHIFT)); That really ought to be the opposite way round: expr & constant. Or add a second line to mask the value. David > > /* If up2tc is out of bounds default to zero */ > if (up2tc > tc) > - reg &= ~(0x7 << IXGBE_RTRUP2TC_UP_SHIFT); > + reg &= ~(IXGBE_RTRUP2TC_UP_MASK << (i * IXGBE_RTRUP2TC_UP_SHIFT)); > } > > if (reg != rsave)