From: "Christian Göttsche" <cgzones@googlemail.com>
To: selinux@vger.kernel.org
Cc: Paul Moore <paul@paul-moore.com>,
Stephen Smalley <stephen.smalley.work@gmail.com>,
Eric Paris <eparis@parisplace.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 4/9] selinux: avoid implicit conversions in mls code
Date: Fri, 28 Jul 2023 17:54:54 +0200 [thread overview]
Message-ID: <20230728155501.39632-3-cgzones@googlemail.com> (raw)
In-Reply-To: <20230728155501.39632-1-cgzones@googlemail.com>
Use u32 for ebitmap bits.
Use char for the default range of a class.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
v2: avoid declarations in init-clauses of for loops
---
security/selinux/ss/mls.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index b2c6c846ea03..cd38f5913b63 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -45,7 +45,7 @@ int mls_compute_context_len(struct policydb *p, struct context *context)
len = 1; /* for the beginning ":" */
for (l = 0; l < 2; l++) {
- int index_sens = context->range.level[l].sens;
+ u32 index_sens = context->range.level[l].sens;
len += strlen(sym_name(p, SYM_LEVELS, index_sens - 1));
/* categories */
@@ -240,7 +240,8 @@ int mls_context_to_sid(struct policydb *pol,
char *sensitivity, *cur_cat, *next_cat, *rngptr;
struct level_datum *levdatum;
struct cat_datum *catdatum, *rngdatum;
- int l, rc, i;
+ u32 i;
+ int l, rc;
char *rangep[2];
if (!pol->mls_enabled) {
@@ -451,7 +452,8 @@ int mls_convert_context(struct policydb *oldp,
struct level_datum *levdatum;
struct cat_datum *catdatum;
struct ebitmap_node *node;
- int l, i;
+ u32 i;
+ int l;
if (!oldp->mls_enabled || !newp->mls_enabled)
return 0;
@@ -495,7 +497,7 @@ int mls_compute_sid(struct policydb *p,
struct range_trans rtr;
struct mls_range *r;
struct class_datum *cladatum;
- int default_range = 0;
+ char default_range = 0;
if (!p->mls_enabled)
return 0;
--
2.40.1
next prev parent reply other threads:[~2023-07-28 15:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 15:54 [PATCH v2 2/9] selinux: use u32 as bit type in ebitmap code Christian Göttsche
2023-07-28 15:54 ` [PATCH v2 3/9] selinux: use identical iterator type in hashtab_duplicate() Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:54 ` Christian Göttsche [this message]
2023-08-04 2:20 ` [PATCH v2 4/9] selinux: avoid implicit conversions in mls code Paul Moore
2023-07-28 15:54 ` [PATCH v2 5/9] selinux: services: update type for number of class permissions Christian Göttsche
2023-07-31 1:46 ` Gong Ruiqi
2023-08-04 2:20 ` Paul Moore
2023-08-04 15:21 ` David Laight
2023-07-28 15:54 ` [PATCH v2 6/9] selinux: avoid implicit conversions in services code Christian Göttsche
2023-07-31 2:01 ` Gong Ruiqi
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:54 ` [PATCH v2 7/9] selinux: avoid implicit conversions in selinuxfs code Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:54 ` [PATCH v2 8/9] selinux: policydb: implicit conversions Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:54 ` [PATCH v2 9/9] selinux: avoid implicit conversion in nlmsgtab code Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-07-28 15:55 ` [PATCH v2 1/9] selinux: avoid implicit conversions in avtab code Christian Göttsche
2023-08-04 2:20 ` Paul Moore
2023-08-04 2:20 ` [PATCH v2 2/9] selinux: use u32 as bit type in ebitmap code Paul Moore
2023-08-04 15:11 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230728155501.39632-3-cgzones@googlemail.com \
--to=cgzones@googlemail.com \
--cc=eparis@parisplace.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®