summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYauheni Kaliuta <ykaliuta@redhat.com>2021-06-08 09:29:22 +0300
committerLucas De Marchi <lucas.demarchi@intel.com>2021-06-09 10:21:15 -0700
commit64541d6aad210879e104e4796beeef49d4311f6d (patch)
treea2020753124bf2f4250f655134b356c514daaf3c
parentb6ecfc916a17eab8f93be5b09f4e4f845aabd3d1 (diff)
downloadkmod-64541d6aad210879e104e4796beeef49d4311f6d.tar.gz
kmod-64541d6aad210879e104e4796beeef49d4311f6d.tar.bz2
kmod-64541d6aad210879e104e4796beeef49d4311f6d.zip
libkmod-module: check "new_from_name" return value in get_builtin
kmod_module_new_from_name() may fail and return error value. It is handled properly across the code, but in this particular place the check is missing. Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
-rw-r--r--libkmod/libkmod-module.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index b6320cc..6e0ff1a 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -2912,7 +2912,10 @@ int kmod_module_get_builtin(struct kmod_ctx *ctx, struct kmod_list **list)
goto fail;
}
- kmod_module_new_from_name(ctx, modname, &mod);
+ err = kmod_module_new_from_name(ctx, modname, &mod);
+ if (err < 0)
+ goto fail;
+
kmod_module_set_builtin(mod, true);
*list = kmod_list_append(*list, mod);