12 Star 6 Fork 44

src-openEuler/kpatch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0038-Fix-undefined-behavior-problem-when-using-list_forea.patch 861 Bytes
一键复制 编辑 原始数据 按行查看 历史
HuBin95 提交于 2024-03-02 00:18 . kpatch: upgrade to 0.9.9
From 2173df77292171f45a6c314af4c7bb73587cad4c Mon Sep 17 00:00:00 2001
From: Weinan Liu <wnliu@google.com>
Date: Wed, 9 Aug 2023 22:31:21 +0000
Subject: [PATCH 38/38] Fix undefined behavior problem when using
list_foreach_entry
This upstream list.h offsetof implementation rely on undefined behavior implementation. Using __builtin_offsetof to fix this problem.
---
kpatch-build/list.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kpatch-build/list.h b/kpatch-build/list.h
index e95593c..ad4643c 100644
--- a/kpatch-build/list.h
+++ b/kpatch-build/list.h
@@ -30,7 +30,7 @@
/**
* Get offset of a member
*/
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#define offsetof(TYPE, MEMBER) ((size_t) __builtin_offsetof(TYPE, MEMBER))
/**
* Casts a member of a structure out to the containing structure
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/kpatch.git
git@gitee.com:src-openeuler/kpatch.git
src-openeuler
kpatch
kpatch
master

搜索帮助