]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
install: string_hash_func should not be fed with NULL
authorLukas Nykryn <lnykryn@redhat.com>
Thu, 14 Feb 2019 19:18:04 +0000 (20:18 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 15 Feb 2019 07:52:58 +0000 (08:52 +0100)
If kmod_module_get_path returns NULL, we should skip that entry,
the hash function does not like NULL pointers.

install/dracut-install.c

index d64de545a0acad5859691e96e501febeafaff190..9e415b5e7a03b2f9deb113334f9b561c3d5b33d9 100644 (file)
@@ -1244,6 +1244,9 @@ static int install_dependent_modules(struct kmod_list *modlist)
                 mod = kmod_module_get_module(itr);
                 path = kmod_module_get_path(mod);
 
+                if (path == NULL)
+                        continue;
+
                if (check_hashmap(items_failed, path))
                        return -1;
 
@@ -1253,7 +1256,7 @@ static int install_dependent_modules(struct kmod_list *modlist)
 
                 name = kmod_module_get_name(mod);
 
-                if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
+                if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
                         continue;
                 }