[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YephYwxThlEYRjp5@kroah.com>
Date: Fri, 21 Jan 2022 08:31:47 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc: jirislaby@...nel.org, jcmvbkbc@...il.com, dsterba@...e.com,
johan@...nel.org, dankamongmen@...il.com,
penguin-kernel@...ove.sakura.ne.jp, igormtorrente@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tty: vt: Check for NULL pointer after calling kzalloc
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@...as.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
Powered by blists - more mailing lists