1 Star 0 Fork 28

kyliwenchong/kmod

forked from src-openEuler/kmod 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-libkmod-module-check-new_from_name-return-value-in-g.patch 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
zhouwenpei 提交于 2021-12-03 12:19 . update verion to 29
From 64541d6aad210879e104e4796beeef49d4311f6d Mon Sep 17 00:00:00 2001
From: Yauheni Kaliuta <ykaliuta@redhat.com>
Date: Tue, 8 Jun 2021 09:29:22 +0300
Subject: [PATCH] libkmod-module: check "new_from_name" return value in
get_builtin
Conflict:NA
Reference:https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/?id=64541d6aad210879e104e4796beeef49d4311f6d
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>
---
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 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);
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kyliwenchong/kmod.git
git@gitee.com:kyliwenchong/kmod.git
kyliwenchong
kmod
kmod
master

搜索帮助