* [PATCH 1/1] tty: Add NULL check to return value of kzalloc()
@ 2013-10-28 5:27 RUC_SoftSec
2013-10-28 15:20 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: RUC_SoftSec @ 2013-10-28 5:27 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Wang YanQing, Dave Airlie,
Andrew Morton
Cc: linux-kernel, RUC_SoftSec
Function kzalloc() may return a NULL pointer, it should be checked against NULL before used.
This bug is found by a static analysis tool developed by RUC_SoftSec, supported by China.X.Orion.
Signed-off-by: RUC_SoftSec <rucsoftsec@gmail.com>
---
drivers/tty/vt/vt.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 9a8e8c5..fcba3ce 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2887,12 +2887,14 @@ static int __init con_init(void)
for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
vc_cons[currcons].d = vc = kzalloc(sizeof(struct vc_data), GFP_NOWAIT);
- INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
- tty_port_init(&vc->port);
- visual_init(vc, currcons, 1);
- vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
- vc_init(vc, vc->vc_rows, vc->vc_cols,
- currcons || !vc->vc_sw->con_save_screen);
+ if (vc) {
+ INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
+ tty_port_init(&vc->port);
+ visual_init(vc, currcons, 1);
+ vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
+ vc_init(vc, vc->vc_rows, vc->vc_cols,
+ currcons || !vc->vc_sw->con_save_screen);
+ }
}
currcons = fg_console = 0;
master_display_fg = vc = vc_cons[currcons].d;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] tty: Add NULL check to return value of kzalloc()
2013-10-28 5:27 [PATCH 1/1] tty: Add NULL check to return value of kzalloc() RUC_SoftSec
@ 2013-10-28 15:20 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-28 15:20 UTC (permalink / raw)
To: RUC_SoftSec
Cc: Jiri Slaby, Wang YanQing, Dave Airlie, Andrew Morton,
linux-kernel
On Mon, Oct 28, 2013 at 01:27:52PM +0800, RUC_SoftSec wrote:
> Function kzalloc() may return a NULL pointer, it should be checked against NULL before used.
> This bug is found by a static analysis tool developed by RUC_SoftSec, supported by China.X.Orion.
>
> Signed-off-by: RUC_SoftSec <rucsoftsec@gmail.com>
I've already explained why I can not accept patches like this, consider
all of them that you sent now deleted from my inbox.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-28 15:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-28 5:27 [PATCH 1/1] tty: Add NULL check to return value of kzalloc() RUC_SoftSec
2013-10-28 15:20 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox