aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/samsung.c
diff options
context:
space:
mode:
authorKeyYoung Park <keyyoung.park@samsung.com>2012-05-30 04:29:55 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-12 18:32:18 -0400
commit7b15e1d9e342aca6c65f4824f1957f5245fcd87a (patch)
tree43f00f2aebac23208ab21135aed99cc48cba369f /drivers/tty/serial/samsung.c
parent25f04ad423e5eb40c33a904db5a0d2c7e3bf08f5 (diff)
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: KeyYoung Park <keyyoung.park@samsung.com> Signed-off-by: Huisung Kang <hs1218.kang@samsung.com> Signed-off-by: Kyoungil Kim <ki0351.kim@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/samsung.c')
-rw-r--r--drivers/tty/serial/samsung.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index cefdd2d7c58c..d57f165d6be8 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1162,7 +1162,8 @@ static ssize_t s3c24xx_serial_show_clksrc(struct device *dev,
1162 if (IS_ERR(ourport->baudclk)) 1162 if (IS_ERR(ourport->baudclk))
1163 return -EINVAL; 1163 return -EINVAL;
1164 1164
1165 return snprintf(buf, PAGE_SIZE, "* %s\n", ourport->baudclk->name); 1165 return snprintf(buf, PAGE_SIZE, "* %s\n",
1166 ourport->baudclk->name ?: "(null)");
1166} 1167}
1167 1168
1168static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL); 1169static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL);