All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: jirislaby@kernel.org, jcmvbkbc@gmail.com, dsterba@suse.com,
	johan@kernel.org, dankamongmen@gmail.com,
	penguin-kernel@i-love.sakura.ne.jp, igormtorrente@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: vt: Check for NULL pointer after calling kzalloc
Date: Fri, 21 Jan 2022 08:31:47 +0100	[thread overview]
Message-ID: <YephYwxThlEYRjp5@kroah.com> (raw)
In-Reply-To: <20220121065320.2283544-1-jiasheng@iscas.ac.cn>

On Fri, Jan 21, 2022 at 02:53:20PM +0800, Jiasheng Jiang wrote:
> As the potential failure of the allocation, the kzalloc() will return
> NULL pointer.
> Therefore, it should be better to check it in order to avoid the
> dereference of the NULL pointer.
> When it fails, we should free all the allocated memory and return error
> number.
> To make the code more clear, I use the 'err_free', like how
> vc_allocate() deals with the allocation failure.
> 
> Fixes: a5f4f52e8211 ("vt: use kzalloc() instead of the bootmem allocator")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/tty/vt/vt.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

Please note that your patches are being ignored by my email systems (I
saw this because Jiri responded to it.)  I recommend at this point in
time that all other kernel subsystem maintainers also ignore them until
you get some more experience and provide changes that work correctly and
are actually tested.

good luck,

greg k-h

      parent reply	other threads:[~2022-01-21  7:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21  6:53 [PATCH] tty: vt: Check for NULL pointer after calling kzalloc Jiasheng Jiang
2022-01-21  7:01 ` Jiri Slaby
2022-01-21  7:31 ` Greg KH [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=YephYwxThlEYRjp5@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dankamongmen@gmail.com \
    --cc=dsterba@suse.com \
    --cc=igormtorrente@gmail.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=jiasheng@iscas.ac.cn \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.