Skip to contentSkip to conversation

unwind: Fix signedness bug in unwind_deferred_request()

PATCH Superseded Dan Carpenter 2 participants 3 messages Nov 19, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unwind: Fix signedness bug in unwind_deferred_request()

The "bit" value comes from "work->bit". It is set to -1 if we cancel the work in unwind_deferred_cancel(). It needs to be signed because we check for negative values. Change the type from unsigned long to int.

Fixes 357eda2d7450 ("unwind deferred: Use SRCU unwind_deferred_task_work()")
---
 kernel/unwind/deferred.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/unwind/deferred.c +1 -2
index a88fb481c4a3..8dc11e0d9374 100644
@@ -232,8 +232,7 @@ int unwind_deferred_request(struct unwind_work *work, u64 *cookie)
 	struct unwind_task_info *info = &current->unwind_info;
 	int twa_mode = TWA_RESUME;
 	unsigned long old, bits;
-	unsigned long bit;
-	int ret;
+	int bit, ret;
 
 	*cookie = 0;
 
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 15 lines · On Wed, 19 Nov 2025 11:10:43 +0300 Dan Carpenter <[email protected]>…

The "bit" value comes from "work->bit". It is set to -1 if we cancel the work in unwind_deferred_cancel(). It needs to be signed because we check for negative values. Change the type from unsigned long to int.

Fixes 357eda2d7450 ("unwind deferred: Use SRCU unwind_deferred_task_work()")
---
 kernel/unwind/deferred.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/unwind/deferred.c +0 -0
index a88fb481c4a3..8dc11e0d9374 100644

kernel/unwind/deferred.c int unwind_deferred_request(struct unwind_work *work, u64 *cookie) · line 235

Quoted 6 lines
kernel/unwind/deferred.c +1 -2
@@ -232,8 +232,7 @@ int unwind_deferred_request(struct unwind_work *work, u64 *cookie)
 	struct unwind_task_info *info = &current->unwind_info;
 	int twa_mode = TWA_RESUME;
 	unsigned long old, bits;
-	unsigned long bit;
-	int ret;
+	int bit, ret;

I'm fine with the change to bit, but please do not put them on the same row. I only do that when the values are related. bit and ret are *not* related.

Thanks,

-- Steve

Quoted 3 lines
kernel/unwind/deferred.c +0 -0
 	*cookie = 0;
 
#2 lore raw
Quoted 13 lines · Steven Rostedt
Quoted 10 lines · On Wed, 19 Nov 2025 11:10:43 +0300 Dan Carpenter <[email protected]>…

The "bit" value comes from "work->bit". It is set to -1 if we cancel the work in unwind_deferred_cancel(). It needs to be signed because we check for negative values. Change the type from unsigned long to int.

Fixes 357eda2d7450 ("unwind deferred: Use SRCU unwind_deferred_task_work()")
---
 kernel/unwind/deferred.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 15 lines

kernel/unwind/deferred.c int unwind_deferred_request(struct unwind_work *work, u64 *cookie) · line 235

Quoted 11 lines
kernel/unwind/deferred.c +1 -2
index a88fb481c4a3..8dc11e0d9374 100644
@@ -232,8 +232,7 @@ int unwind_deferred_request(struct unwind_work *work, u64 *cookie)
 	struct unwind_task_info *info = &current->unwind_info;
 	int twa_mode = TWA_RESUME;
 	unsigned long old, bits;
-	unsigned long bit;
-	int ret;
+	int bit, ret;

I'm fine with the change to bit, but please do not put them on the same row. I only do that when the values are related. bit and ret are *not* related.

Sure, I've sent a v2.

regards,
dan carpenter