backport bugfix from upstream
(cherry picked from commit 1f579cdcb434025d98644a74b2af544feaed51f2)
This commit is contained in:
parent
776e4b1d8e
commit
59a23d7293
75
backport-libsepol-reorder-calloc-3-arguments.patch
Normal file
75
backport-libsepol-reorder-calloc-3-arguments.patch
Normal file
@ -0,0 +1,75 @@
|
||||
From a0ff05efca3bb04b08a5f5274016d9f1286e9517 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:31 +0100
|
||||
Subject: [PATCH] libsepol: 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:
|
||||
|
||||
kernel_to_conf.c:814:47: warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
|
||||
kernel_to_conf.c:945:46: warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
|
||||
kernel_to_conf.c:2109:35: warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
|
||||
kernel_to_common.c:578:29: 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/a0ff05efca3bb04b08a5f5274016d9f1286e9517
|
||||
Conflict: Context adaptation in kernel_to_common.c.
|
||||
---
|
||||
libsepol/src/kernel_to_common.c | 2 +-
|
||||
libsepol/src/kernel_to_conf.c | 6 +++---
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libsepol/src/kernel_to_common.c b/libsepol/src/kernel_to_common.c
|
||||
index 4612eef3..2422eed0 100644
|
||||
--- a/libsepol/src/kernel_to_common.c
|
||||
+++ b/libsepol/src/kernel_to_common.c
|
||||
@@ -575,7 +575,7 @@ static int sort_ocontext_data(struct ocontext **ocons, int (*cmp)(const void *,
|
||||
return 0;
|
||||
}
|
||||
|
||||
- data = calloc(sizeof(*data), num);
|
||||
+ data = calloc(num, sizeof(*data));
|
||||
if (!data) {
|
||||
sepol_log_err("Out of memory\n");
|
||||
return -1;
|
||||
diff --git a/libsepol/src/kernel_to_conf.c b/libsepol/src/kernel_to_conf.c
|
||||
index 83f46e0f..e6b449b4 100644
|
||||
--- a/libsepol/src/kernel_to_conf.c
|
||||
+++ b/libsepol/src/kernel_to_conf.c
|
||||
@@ -811,7 +811,7 @@ static int write_sensitivity_rules_to_conf(FILE *out, struct policydb *pdb)
|
||||
num = strs_num_items(strs);
|
||||
|
||||
if (num > 0) {
|
||||
- sens_alias_map = calloc(sizeof(*sens_alias_map), pdb->p_levels.nprim);
|
||||
+ sens_alias_map = calloc(pdb->p_levels.nprim, sizeof(*sens_alias_map));
|
||||
if (!sens_alias_map) {
|
||||
rc = -1;
|
||||
goto exit;
|
||||
@@ -942,7 +942,7 @@ static int write_category_rules_to_conf(FILE *out, struct policydb *pdb)
|
||||
num = strs_num_items(strs);
|
||||
|
||||
if (num > 0) {
|
||||
- cat_alias_map = calloc(sizeof(*cat_alias_map), pdb->p_cats.nprim);
|
||||
+ cat_alias_map = calloc(pdb->p_cats.nprim, sizeof(*cat_alias_map));
|
||||
if (!cat_alias_map) {
|
||||
rc = -1;
|
||||
goto exit;
|
||||
@@ -2106,7 +2106,7 @@ static int write_cond_nodes_to_conf(FILE *out, struct policydb *pdb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- cond_data = calloc(sizeof(struct cond_data), num);
|
||||
+ cond_data = calloc(num, sizeof(struct cond_data));
|
||||
if (!cond_data) {
|
||||
rc = -1;
|
||||
goto exit;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: libsepol
|
||||
Version: 3.5
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: SELinux binary policy manipulation library
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/SELinuxProject/selinux/wiki/Releases
|
||||
@ -13,6 +13,7 @@ Patch0004: backport-libsepol-expand-use-identical-type-to-avoid-implicit-co
|
||||
Patch0005: backport-libsepol-cil-Fix-class-permission-verification-in-CIL.patch
|
||||
Patch0006: backport-libsepol-validate-old-style-range-trans-classes.patch
|
||||
Patch0007: backport-libsepol-validate-check-low-category-is-not-bigger-than-high.patch
|
||||
Patch0008: backport-libsepol-reorder-calloc-3-arguments.patch
|
||||
|
||||
BuildRequires: gcc flex
|
||||
|
||||
@ -73,6 +74,9 @@ make DESTDIR="%{buildroot}" LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" install
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* Tue Mar 26 2024 gengqihu <gengqihu2@h-partners.com> - 3.5-3
|
||||
- backport bugfix from upstream
|
||||
|
||||
* Sat Nov 25 2023 huangzq6 <huangzhenqiang2@huawei.com> - 3.5-2
|
||||
- backport bugfix from upstream
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user