Add check if the mount callback is set.

This commit is contained in:
Enrico Fraccaroli
2021-12-13 21:10:17 +01:00
parent f6090319c7
commit 43d34814bf
+4
View File
@@ -372,6 +372,10 @@ int do_mount(const char *type, const char *path, const char *args)
pr_err("Unknown filesystem type: %s\n", type); pr_err("Unknown filesystem type: %s\n", type);
return -ENODEV; return -ENODEV;
} }
if (fst->mount == NULL) {
pr_err("No mount callback set: %s\n", type);
return -ENODEV;
}
vfs_file_t *file = fst->mount(path, args); vfs_file_t *file = fst->mount(path, args);
if (file == NULL) { if (file == NULL) {
pr_err("Mount callback return a null pointer: %s\n", type); pr_err("Mount callback return a null pointer: %s\n", type);