From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97D4E317164; Thu, 28 May 2026 20:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000929; cv=none; b=iaTxD2Xc3Ykfr2Zv0Inm0ObsgN9YpnNTv6fXY+3mrjkHotkw3El7suHhTH5X5v05wJrX5++HCqXEnfnm0cO9ISmKfcAmyXffTF1wyHC6SAGw8m5lc5OgI7oNpRd9Jjp+uGmQmgdc4f6h9seSOnXeXGEL6bUAManu9y6uV1K66v8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000929; c=relaxed/simple; bh=y0vIpfGrMNxP2O95mSsPsZVOimjPQy1mcyvGdBq0VI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=miOT+x+SCa1KyyKw5n9fJCB6T8tPwHW47pMJ9lqzsmBa9CEwDvTIiQiYt0ZFvb9fN+jmkCA/PS5U7dXgANVfujZH3sfnvS0AGd6oZWJ9mnKhtY+Y3+JDfiJjeezm1qiKkQHlF9VDszvzpRt3VmRCpkzTRUx8vGVXd61PmqyZ9OQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f6ZS7k+c; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="f6ZS7k+c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 015071F000E9; Thu, 28 May 2026 20:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780000928; bh=JHWRjG9DW4cWcRT439oSv4ZOsgXwhqjeaQSgBJtTdHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=f6ZS7k+cZsReaP+OOrkyEK0uGyDwFQ4KkL67E9rlwjyszMRKFzC0eh0B+A/1IR+fk YsPCriT9RU2MZi/1YIXMadd9NHptvV9OPb3qJ+D5ibNaTWt6T4fVLrRbbFFuyVSC8/ 1bWB4AZSxDYx+RYPod+Ni6U5i91L2Qsah1l4YAFI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chenguang Zhao , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 220/272] ethtool: fix ethnl_bitmap32_not_zero() bit interval semantics Date: Thu, 28 May 2026 21:49:54 +0200 Message-ID: <20260528194635.360877021@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194629.379955525@linuxfoundation.org> References: <20260528194629.379955525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chenguang Zhao [ Upstream commit 3d042592ebd4c7e44974d556de0b727cb7db4dab ] ethnl_bitmap32_not_zero() should return true if some bit in [start, end) is set: - Fix inverted memchr_inv() sense: return true when the scan finds a non-zero byte, not when the middle words are all zero. - Return false for an empty interval (end <= start). - When end is 32-bit aligned, indices in [start, end) do not include any bits from map[end_word]; return false after earlier checks found no non-zero data. Fixes: 10b518d4e6dd ("ethtool: netlink bitset handling") Signed-off-by: Chenguang Zhao Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ethtool/bitset.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ethtool/bitset.c b/net/ethtool/bitset.c index f0883357d12e5..4691d6d0f2b75 100644 --- a/net/ethtool/bitset.c +++ b/net/ethtool/bitset.c @@ -91,7 +91,7 @@ static bool ethnl_bitmap32_not_zero(const u32 *map, unsigned int start, u32 mask; if (end <= start) - return true; + return false; if (start % 32) { mask = ethnl_upper_bits(start); @@ -104,11 +104,11 @@ static bool ethnl_bitmap32_not_zero(const u32 *map, unsigned int start, start_word++; } - if (!memchr_inv(map + start_word, '\0', - (end_word - start_word) * sizeof(u32))) + if (memchr_inv(map + start_word, '\0', + (end_word - start_word) * sizeof(u32))) return true; if (end % 32 == 0) - return true; + return false; return map[end_word] & ethnl_lower_bits(end); } -- 2.53.0