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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ykaliuta@xxxxxxxxxx>

applied, thanks

Lucas De Marchi

---
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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux