remoteproc: Check for NULL firmwares in sysfs interface
[linux-2.6-microblaze.git] / drivers / remoteproc / remoteproc_sysfs.c
index 47be411..3a4c3d7 100644 (file)
@@ -48,6 +48,11 @@ static ssize_t firmware_store(struct device *dev,
        }
 
        len = strcspn(buf, "\n");
+       if (!len) {
+               dev_err(dev, "can't provide a NULL firmware\n");
+               err = -EINVAL;
+               goto out;
+       }
 
        p = kstrndup(buf, len, GFP_KERNEL);
        if (!p) {