Commit f0758616 authored by Christian Göttsche's avatar Christian Göttsche Committed by Paul Moore
Browse files

selinux: use known type instead of void pointer



Improve type safety and readability by using the known type.

Signed-off-by: default avatarChristian Göttsche <cgzones@googlemail.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 83e7e18e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ static const uint16_t spec_order[] = {
};
/* clang-format on */

int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
int avtab_read_item(struct avtab *a, struct policy_file *fp, struct policydb *pol,
		    int (*insertf)(struct avtab *a, const struct avtab_key *k,
				   const struct avtab_datum *d, void *p),
		    void *p, bool conditional)
@@ -507,7 +507,7 @@ static int avtab_insertf(struct avtab *a, const struct avtab_key *k,
	return avtab_insert(a, k, d);
}

int avtab_read(struct avtab *a, void *fp, struct policydb *pol)
int avtab_read(struct avtab *a, struct policy_file *fp, struct policydb *pol)
{
	int rc;
	__le32 buf[1];
@@ -550,7 +550,7 @@ int avtab_read(struct avtab *a, void *fp, struct policydb *pol)
	goto out;
}

int avtab_write_item(struct policydb *p, const struct avtab_node *cur, void *fp)
int avtab_write_item(struct policydb *p, const struct avtab_node *cur, struct policy_file *fp)
{
	__le16 buf16[4];
	__le32 buf32[ARRAY_SIZE(cur->datum.u.xperms->perms.p)];
@@ -586,7 +586,7 @@ int avtab_write_item(struct policydb *p, const struct avtab_node *cur, void *fp)
	return 0;
}

int avtab_write(struct policydb *p, struct avtab *a, void *fp)
int avtab_write(struct policydb *p, struct avtab *a, struct policy_file *fp)
{
	u32 i;
	int rc = 0;
+5 −4
Original line number Diff line number Diff line
@@ -105,15 +105,16 @@ static inline void avtab_hash_eval(struct avtab *h, const char *tag)
#endif

struct policydb;
int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
struct policy_file;
int avtab_read_item(struct avtab *a, struct policy_file *fp, struct policydb *pol,
		    int (*insert)(struct avtab *a, const struct avtab_key *k,
				  const struct avtab_datum *d, void *p),
		    void *p, bool conditional);

int avtab_read(struct avtab *a, void *fp, struct policydb *pol);
int avtab_read(struct avtab *a, struct policy_file *fp, struct policydb *pol);
int avtab_write_item(struct policydb *p, const struct avtab_node *cur,
		     void *fp);
int avtab_write(struct policydb *p, struct avtab *a, void *fp);
		     struct policy_file *fp);
int avtab_write(struct policydb *p, struct avtab *a, struct policy_file *fp);

struct avtab_node *avtab_insert_nonunique(struct avtab *h,
					  const struct avtab_key *key,
+6 −6
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ static int bool_isvalid(struct cond_bool_datum *b)
	return 1;
}

int cond_read_bool(struct policydb *p, struct symtab *s, void *fp)
int cond_read_bool(struct policydb *p, struct symtab *s, struct policy_file *fp)
{
	char *key = NULL;
	struct cond_bool_datum *booldatum;
@@ -323,7 +323,7 @@ static int cond_insertf(struct avtab *a, const struct avtab_key *k,
	return 0;
}

static int cond_read_av_list(struct policydb *p, void *fp,
static int cond_read_av_list(struct policydb *p, struct policy_file *fp,
			     struct cond_av_list *list,
			     struct cond_av_list *other)
{
@@ -375,7 +375,7 @@ static int expr_node_isvalid(struct policydb *p, struct cond_expr_node *expr)
	return 1;
}

static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
static int cond_read_node(struct policydb *p, struct cond_node *node, struct policy_file *fp)
{
	__le32 buf[2];
	u32 i, len;
@@ -415,7 +415,7 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp)
	return cond_read_av_list(p, fp, &node->false_list, &node->true_list);
}

int cond_read_list(struct policydb *p, void *fp)
int cond_read_list(struct policydb *p, struct policy_file *fp)
{
	__le32 buf[1];
	u32 i, len;
@@ -453,7 +453,7 @@ int cond_write_bool(void *vkey, void *datum, void *ptr)
	char *key = vkey;
	struct cond_bool_datum *booldatum = datum;
	struct policy_data *pd = ptr;
	void *fp = pd->fp;
	struct policy_file *fp = pd->fp;
	__le32 buf[3];
	u32 len;
	int rc;
@@ -536,7 +536,7 @@ static int cond_write_node(struct policydb *p, struct cond_node *node,
	return 0;
}

int cond_write_list(struct policydb *p, void *fp)
int cond_write_list(struct policydb *p, struct policy_file *fp)
{
	u32 i;
	__le32 buf[1];
+3 −3
Original line number Diff line number Diff line
@@ -68,10 +68,10 @@ int cond_destroy_bool(void *key, void *datum, void *p);

int cond_index_bool(void *key, void *datum, void *datap);

int cond_read_bool(struct policydb *p, struct symtab *s, void *fp);
int cond_read_list(struct policydb *p, void *fp);
int cond_read_bool(struct policydb *p, struct symtab *s, struct policy_file *fp);
int cond_read_list(struct policydb *p, struct policy_file *fp);
int cond_write_bool(void *key, void *datum, void *ptr);
int cond_write_list(struct policydb *p, void *fp);
int cond_write_list(struct policydb *p, struct policy_file *fp);

void cond_compute_av(struct avtab *ctab, struct avtab_key *key,
		     struct av_decision *avd, struct extended_perms *xperms);
+2 −2
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ void ebitmap_destroy(struct ebitmap *e)
	e->node = NULL;
}

int ebitmap_read(struct ebitmap *e, void *fp)
int ebitmap_read(struct ebitmap *e, struct policy_file *fp)
{
	struct ebitmap_node *n = NULL;
	u32 mapunit, count, startbit, index, i;
@@ -478,7 +478,7 @@ int ebitmap_read(struct ebitmap *e, void *fp)
	goto out;
}

int ebitmap_write(const struct ebitmap *e, void *fp)
int ebitmap_write(const struct ebitmap *e, struct policy_file *fp)
{
	struct ebitmap_node *n;
	u32 bit, count, last_bit, last_startbit;
Loading