From: Ondrej Mosnacek <omosnace@redhat.com>
To: selinux@vger.kernel.org, Paul Moore <paul@paul-moore.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Subject: [PATCH v2 2/3] selinux: policydb - fix some checkpatch.pl warnings
Date: Mon, 29 Jul 2019 10:41:16 +0200 [thread overview]
Message-ID: <20190729084117.18677-3-omosnace@redhat.com> (raw)
In-Reply-To: <20190729084117.18677-1-omosnace@redhat.com>
Fix most of the code style warnings discovered when moving code around.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
security/selinux/ss/policydb.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 451f2bcd2d83..ffeae0e252d2 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -334,6 +334,7 @@ static int (*destroy_f[SYM_NUM]) (void *key, void *datum, void *datap) =
static int filenametr_destroy(void *key, void *datum, void *p)
{
struct filename_trans *ft = key;
+
kfree(ft->name);
kfree(key);
kfree(datum);
@@ -344,6 +345,7 @@ static int filenametr_destroy(void *key, void *datum, void *p)
static int range_tr_destroy(void *key, void *datum, void *p)
{
struct mls_range *rt = datum;
+
kfree(key);
ebitmap_destroy(&rt->level[0].cat);
ebitmap_destroy(&rt->level[1].cat);
@@ -526,6 +528,7 @@ static int filenametr_cmp(struct hashtab *h, const void *k1, const void *k2)
static u32 rangetr_hash(struct hashtab *h, const void *k)
{
const struct range_trans *key = k;
+
return (key->source_type + (key->target_type << 3) +
(key->target_class << 5)) & (h->size - 1);
}
@@ -575,7 +578,8 @@ static int policydb_init(struct policydb *p)
if (rc)
goto out;
- p->filename_trans = hashtab_create(filenametr_hash, filenametr_cmp, (1 << 10));
+ p->filename_trans = hashtab_create(filenametr_hash, filenametr_cmp,
+ (1 << 10));
if (!p->filename_trans) {
rc = -ENOMEM;
goto out;
@@ -751,9 +755,9 @@ static void hash_eval(struct hashtab *h, const char *hash_name)
struct hashtab_info info;
hashtab_stat(h, &info);
- pr_debug("SELinux: %s: %d entries and %d/%d buckets used, "
- "longest chain length %d\n", hash_name, h->nel,
- info.slots_used, h->size, info.max_chain_len);
+ pr_debug("SELinux: %s: %d entries and %d/%d buckets used, longest chain length %d\n",
+ hash_name, h->nel, info.slots_used, h->size,
+ info.max_chain_len);
}
static void symtab_hash_eval(struct symtab *s)
--
2.21.0
next prev parent reply other threads:[~2019-07-29 8:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 8:41 [PATCH v2 0/3] selinux: policydb - fix memory leak and do some cleanup Ondrej Mosnacek
2019-07-29 8:41 ` [PATCH v2 1/3] selinux: policydb - fix memory leak in policydb_init() Ondrej Mosnacek
2019-07-29 22:48 ` Paul Moore
2019-07-30 12:20 ` Ondrej Mosnacek
2019-07-30 15:10 ` Paul Moore
2019-07-30 16:15 ` Ondrej Mosnacek
2019-07-30 23:15 ` Paul Moore
2019-07-31 22:07 ` Paul Moore
2019-07-29 8:41 ` Ondrej Mosnacek [this message]
2019-08-05 20:48 ` [PATCH v2 2/3] selinux: policydb - fix some checkpatch.pl warnings Paul Moore
2019-07-29 8:41 ` [PATCH v2 3/3] selinux: policydb - rename type_val_to_struct_array Ondrej Mosnacek
2019-08-05 20:49 ` Paul Moore
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=20190729084117.18677-3-omosnace@redhat.com \
--to=omosnace@redhat.com \
--cc=dvyukov@google.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).