mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
firmware: imx: sm-misc: Add NULL check for kmalloc in syslog_show
Add a proper NULL check for the kmalloc() return value in syslog_show().
If memory allocation fails, syslog would be NULL and passing it to
misc_syslog() could lead to a NULL pointer dereference.
Fixes: 80a4062e88 ("firmware: imx: sm-misc: Dump syslog info")
Signed-off-by: Li Jun <lijun01@kylinos.cn>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
This commit is contained in:
parent
3de939b2ac
commit
4cf26bc2e7
|
|
@ -79,6 +79,9 @@ static int syslog_show(struct seq_file *file, void *priv)
|
|||
u16 size = SZ_4K / 4;
|
||||
int ret;
|
||||
|
||||
if (!syslog)
|
||||
return -ENOMEM;
|
||||
|
||||
if (!ph)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user