diff options
Diffstat (limited to '')
-rw-r--r-- | drivers/of/device.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c index 258742830..566d8af05 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -258,12 +258,15 @@ int of_device_request_module(struct device *dev) if (size < 0) return size; - str = kmalloc(size + 1, GFP_KERNEL); + /* Reserve an additional byte for the trailing '\0' */ + size++; + + str = kmalloc(size, GFP_KERNEL); if (!str) return -ENOMEM; of_device_get_modalias(dev, str, size); - str[size] = '\0'; + str[size - 1] = '\0'; ret = request_module(str); kfree(str); |