Dan Carpenter <[email protected]> reported the following Smatch
warning:
drivers/tty/n_gsm.c:720 gsm_data_kick()
warn: sleeping in atomic context
This is because gsm_control_message() is holding a spin lock so
gsm_hex_dump_bytes() needs to use GFP_ATOMIC instead of GFP_KERNEL.
Fixes: 925ea0fa5277 ("tty: n_gsm: Fix packet data hex dump output")
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
---
drivers/tty/n_gsm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -459,7 +459,7 @@ static void gsm_hex_dump_bytes(const char *fname, const u8 *data,
return;
}
- prefix = kasprintf(GFP_KERNEL, "%s: ", fname);
+ prefix = kasprintf(GFP_ATOMIC, "%s: ", fname);
if (!prefix)
return;
print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len,
--
2.36.1
Tony Lindgren <[email protected]> writes:
> Dan Carpenter <[email protected]> reported the following Smatch
> warning:
>
> drivers/tty/n_gsm.c:720 gsm_data_kick()
> warn: sleeping in atomic context
>
> This is because gsm_control_message() is holding a spin lock so
> gsm_hex_dump_bytes() needs to use GFP_ATOMIC instead of GFP_KERNEL.
>
> Fixes: 925ea0fa5277 ("tty: n_gsm: Fix packet data hex dump output")
> Reported-by: Dan Carpenter <[email protected]>
> Signed-off-by: Tony Lindgren <[email protected]>
Reviewed-by: Gregory CLEMENT <[email protected]>
> ---
> drivers/tty/n_gsm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c
> @@ -459,7 +459,7 @@ static void gsm_hex_dump_bytes(const char *fname, const u8 *data,
> return;
> }
>
> - prefix = kasprintf(GFP_KERNEL, "%s: ", fname);
> + prefix = kasprintf(GFP_ATOMIC, "%s: ", fname);
> if (!prefix)
> return;
> print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len,
> --
> 2.36.1
--
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com