Thread (8 messages) 8 messages, 2 authors, 2021-06-22

Re: [PATCH 1/2] libkmod-module: check "new_from_name" return value in get_builtin

flat view

From: Lucas De Marchi <hidden>
Date: 2021-06-09 17:22:18

On Tue, Jun 08, 2021 at 09:29:22AM +0300, Yauheni Kaliuta wrote:
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 <redacted>
applied, thanks

Lucas De Marchi
quoted hunk ↗ jump to hunk
---
libkmod/libkmod-module.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index b6320cc87e80..6e0ff1a99604 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);
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help