10 Star 3 Fork 16

src-openEuler/libselinux

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libselinux-reorder-calloc-3-arguments.patch 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
fly_fzc 提交于 2024-03-25 19:11 . backport upstream patches
From b18fddef2e0aecb1cfba4cc3e495ea9ba09b49bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Fri, 5 Jan 2024 19:35:32 +0100
Subject: [PATCH] libselinux: reorder calloc(3) arguments
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The canonical order of calloc(3) parameters is the number of elements
first and the size of each element second.
Reported by GCC 14:
is_customizable_type.c:43:45: warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
Reference:https://github.com/SELinuxProject/selinux/commit/b18fddef2e0aecb1cfba4cc3e495ea9ba09b49bd
Conflict:path adapt
---
src/is_customizable_type.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/is_customizable_type.c b/src/is_customizable_type.c
index da301c60..0ae92c8d 100644
--- a/src/is_customizable_type.c
+++ b/src/is_customizable_type.c
@@ -39,9 +39,7 @@ static int get_customizable_type_list(char *** retlist)
}
rewind(fp);
if (ctr) {
- list =
- (char **) calloc(sizeof(char *),
- ctr + 1);
+ list = calloc(ctr + 1, sizeof(char *));
if (list) {
i = 0;
while (fgets_unlocked(buf, selinux_page_size, fp)
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libselinux.git
git@gitee.com:src-openeuler/libselinux.git
src-openeuler
libselinux
libselinux
master

搜索帮助