From nobody Sun Feb 8 05:42:02 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 93A152F90C4 for ; Tue, 3 Feb 2026 21:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770155981; cv=none; b=KEQ57lyFT3eHkFvQrrRxvjQhPwnKn1+seJTQ8K9j4KgILLYOL0xlwFlFlI11L5P7T87/3z2dxe/qiCAh00ZWjHEPlHlrDgbuW8PZceAxB3kfR26fvo4VW6omZevRuuySiH5GoHc26berGg87o5iySbkO232QZnB9l4K/g1Q/h/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770155981; c=relaxed/simple; bh=GypFtYupZ5G7BuF4gr13VL9kuS6AqMIS0d30hQEBXP4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gU8T2pY/vmpmUSXD1p87KsWqwXcXSilNSezgZ5rf3e6BHt0P1sEmGF9LVH1LUx2R2NnmvlCf8ALknpbVoBx1CjNU86xD2c8BCe++tKZkTt4NvHl46RpE+a9srOu23Bjcj2vlXVteOjPRvIp0M7ffbPXoKWZXUgBngVBtOxFTwnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ns1MfKDz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ns1MfKDz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E1BDC2BC87; Tue, 3 Feb 2026 21:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770155981; bh=GypFtYupZ5G7BuF4gr13VL9kuS6AqMIS0d30hQEBXP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ns1MfKDzaS+hcGcldb7KZAuMRri81/z45DXYqS0S/hsT+oASjoisjRqcsIwbk60C6 ZhMv1tR3sxWCzI9uyiOrrBmvYvzUu1bkq1wYoYkDh2jx2P9xw0vUvwZNhg7wztddQS kUY59ZMXZ2Gw7+gSur225bD5VhvSNwz021001zEZpzb0C4LQMKnGeJ1dinWquZjyCU 1/ZsfjwgL1ascHYdwWf+N46Ck0hMMIvHTjtiNaqMZwY2+W+xG/BixKMqcWLkMKVXjY LRTo8P7fSdhDXxIN5xv5zQYMX2Na7GAZ/NmowPNHivyUex17ocjmwKyrZ9FVSm2BB3 y8Upf7M7iIICg== From: Josh Poimboeuf To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Julia Lawall Subject: [PATCH 1/2] unwind: Fix negative bit check in unwind_deferred_request() Date: Tue, 3 Feb 2026 13:59:32 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The following warning will never trigger because 'bit' is unsigned: if (WARN_ON_ONCE(bit < 0)) return -EINVAL; That variable is used for two distinct purposes, so split it into two variables accordingly: an 'int bit' and an 'unsigned long bit_mask'. Rename a few other variables for consistency with the "*_mask" scheme. Fixes: 357eda2d7450 ("unwind deferred: Use SRCU unwind_deferred_task_work()= ") Reported-by: Julia Lawall Signed-off-by: Josh Poimboeuf --- kernel/unwind/deferred.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/kernel/unwind/deferred.c b/kernel/unwind/deferred.c index a88fb481c4a3..416af9b98bad 100644 --- a/kernel/unwind/deferred.c +++ b/kernel/unwind/deferred.c @@ -230,10 +230,9 @@ void unwind_deferred_task_exit(struct task_struct *tas= k) int unwind_deferred_request(struct unwind_work *work, u64 *cookie) { struct unwind_task_info *info =3D ¤t->unwind_info; + unsigned long bit_mask, old_mask, new_mask; int twa_mode =3D TWA_RESUME; - unsigned long old, bits; - unsigned long bit; - int ret; + int bit, ret; =20 *cookie =3D 0; =20 @@ -257,17 +256,16 @@ int unwind_deferred_request(struct unwind_work *work,= u64 *cookie) if (WARN_ON_ONCE(bit < 0)) return -EINVAL; =20 - /* Only need the mask now */ - bit =3D BIT(bit); + bit_mask =3D BIT(bit); =20 guard(irqsave)(); =20 *cookie =3D get_cookie(info); =20 - old =3D atomic_long_read(&info->unwind_mask); + old_mask =3D atomic_long_read(&info->unwind_mask); =20 /* Is this already queued or executed */ - if (old & bit) + if (old_mask & bit_mask) return 1; =20 /* @@ -276,15 +274,15 @@ int unwind_deferred_request(struct unwind_work *work,= u64 *cookie) * work's bit or PENDING was already set, then this is already queued * to have a callback. */ - bits =3D UNWIND_PENDING | bit; - old =3D atomic_long_fetch_or(bits, &info->unwind_mask); - if (old & bits) { + new_mask =3D UNWIND_PENDING | bit_mask; + old_mask =3D atomic_long_fetch_or(new_mask, &info->unwind_mask); + if (old_mask & new_mask) { /* * If the work's bit was set, whatever set it had better * have also set pending and queued a callback. */ - WARN_ON_ONCE(!(old & UNWIND_PENDING)); - return old & bit; + WARN_ON_ONCE(!(old_mask & UNWIND_PENDING)); + return old_mask & bit_mask; } =20 /* The work has been claimed, now schedule it. */ --=20 2.52.0