summaryrefslogtreecommitdiff
path: root/drivers/firmware
diff options
context:
space:
mode:
authorLi Jun <lijun01@kylinos.cn>2026-06-10 08:38:14 +0800
committerFrank Li <Frank.Li@nxp.com>2026-06-29 16:40:53 -0400
commit4cf26bc2e7e099c86127d63ed7272753da45737e (patch)
tree5e7d6566373aa784eadf80dc2a9187ec400f8373 /drivers/firmware
parent3de939b2ac843d56d88e2ab1e1b1f667cba9e1d4 (diff)
downloadlinux-next-4cf26bc2e7e099c86127d63ed7272753da45737e.tar.gz
linux-next-4cf26bc2e7e099c86127d63ed7272753da45737e.zip
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: 80a4062e8821 ("firmware: imx: sm-misc: Dump syslog info") Signed-off-by: Li Jun <lijun01@kylinos.cn> Signed-off-by: Frank Li <Frank.Li@nxp.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/imx/sm-misc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/imx/sm-misc.c b/drivers/firmware/imx/sm-misc.c
index ac9af824c2d4..fb8d7bdb5b08 100644
--- a/drivers/firmware/imx/sm-misc.c
+++ b/drivers/firmware/imx/sm-misc.c
@@ -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;