Re: [PATCH printk v1 06/18] printk: nobkl: Add acquire/release logic
From: John Ogness
Date: Mon Mar 06 2023 - 04:41:18 EST
On 2023-03-06, Dan Carpenter <error27@xxxxxxxxx> wrote:
> smatch warnings:
> kernel/printk/printk_nobkl.c:391 cons_try_acquire_spin() warn: signedness bug returning '(-16)'
Great catch. That function used to return bool, but recently changed to
int. The consequence of the bug is that a waiter could prematurely abort
the spin.
diff --git a/kernel/printk/printk_nobkl.c b/kernel/printk/printk_nobkl.c
index 78136347a328..bcd75e5bd9c8 100644
--- a/kernel/printk/printk_nobkl.c
+++ b/kernel/printk/printk_nobkl.c
@@ -305,7 +305,7 @@ static bool cons_setup_request(struct cons_context *ctxt, struct cons_state old)
* handover request setup by cons_setup_handover() is now invalidated and
* must be performed again).
*/
-static bool cons_try_acquire_spin(struct cons_context *ctxt)
+static int cons_try_acquire_spin(struct cons_context *ctxt)
{
struct console *con = ctxt->console;
struct cons_state cur;