public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Tony Lindgren <tony@atomide.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Daniel Starke <daniel.starke@siemens.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	Johan Hovold <johan@kernel.org>,
	Zhenguo Zhao <Zhenguo.Zhao1@unisoc.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] tty: n_gsm: Debug output allocation must use GFP_ATOMIC
Date: Wed, 25 May 2022 15:32:46 +0200	[thread overview]
Message-ID: <87sfoxyby9.fsf@BL-laptop> (raw)
In-Reply-To: <20220523155052.57129-1-tony@atomide.com>

Tony Lindgren <tony@atomide.com> writes:

> Dan Carpenter <dan.carpenter@oracle.com> 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 <dan.carpenter@oracle.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>


Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>


> ---
>  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

      reply	other threads:[~2022-05-25 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 15:50 [PATCH] tty: n_gsm: Debug output allocation must use GFP_ATOMIC Tony Lindgren
2022-05-25 13:32 ` Gregory CLEMENT [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfoxyby9.fsf@BL-laptop \
    --to=gregory.clement@bootlin.com \
    --cc=Zhenguo.Zhao1@unisoc.com \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel.starke@siemens.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox