summaryrefslogtreecommitdiff
path: root/drivers/of/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/device.c')
-rw-r--r--drivers/of/device.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 9d0895fb53b5..c5c06997fdd2 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -257,6 +257,8 @@ ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len)
ssize_t sl = of_device_get_modalias(dev, str, len - 2);
if (sl < 0)
return sl;
+ if (sl > len - 2)
+ return -ENOMEM;
str[sl++] = '\n';
str[sl] = 0;