Эх сурвалжийг харах

UBI: bugfix: dont oops with NULL module parameter

E.g., it oopsed in case of: modprobe ubi mtd = 0

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Artem Bityutskiy 18 жил өмнө
parent
commit
77c722dde9

+ 3 - 0
drivers/mtd/ubi/build.c

@@ -845,6 +845,9 @@ static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
 	char *pbuf = &buf[0];
 	char *pbuf = &buf[0];
 	char *tokens[3] = {NULL, NULL, NULL};
 	char *tokens[3] = {NULL, NULL, NULL};
 
 
+	if (!val)
+		return -EINVAL;
+
 	if (mtd_devs == UBI_MAX_DEVICES) {
 	if (mtd_devs == UBI_MAX_DEVICES) {
 		printk("UBI error: too many parameters, max. is %d\n",
 		printk("UBI error: too many parameters, max. is %d\n",
 		       UBI_MAX_DEVICES);
 		       UBI_MAX_DEVICES);