提交 7b15e1d9 编写于 作者: K KeyYoung Park 提交者: Greg Kroah-Hartman

serial: samsung: protect NULL dereference of clock name

When priting the serial clock source, if clock source name is null,
kernel reference NULL point.
Signed-off-by: NKeyYoung Park <keyyoung.park@samsung.com>
Signed-off-by: NHuisung Kang <hs1218.kang@samsung.com>
Signed-off-by: NKyoungil Kim <ki0351.kim@samsung.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 25f04ad4
......@@ -1162,7 +1162,8 @@ static ssize_t s3c24xx_serial_show_clksrc(struct device *dev,
if (IS_ERR(ourport->baudclk))
return -EINVAL;
return snprintf(buf, PAGE_SIZE, "* %s\n", ourport->baudclk->name);
return snprintf(buf, PAGE_SIZE, "* %s\n",
ourport->baudclk->name ?: "(null)");
}
static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册