Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50c205f5 authored by Eric Paris's avatar Eric Paris
Browse files

LSM: do not initialize common_audit_data to 0



It isn't needed.  If you don't set the type of the data associated with
that type it is a pretty obvious programming bug.  So why waste the cycles?

Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent 07f62eb6
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -92,11 +92,6 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb,
int ipv6_skb_to_auditdata(struct sk_buff *skb,
		struct common_audit_data *ad, u8 *proto);

/* Initialize an LSM audit data structure. */
#define COMMON_AUDIT_DATA_INIT(_d, _t) \
	{ memset((_d), 0, sizeof(struct common_audit_data)); \
	 (_d)->type = _t; }

void common_lsm_audit(struct common_audit_data *a,
	void (*pre_audit)(struct audit_buffer *, void *),
	void (*post_audit)(struct audit_buffer *, void *));
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ static int audit_caps(struct aa_profile *profile, struct task_struct *task,
	int type = AUDIT_APPARMOR_AUTO;
	struct common_audit_data sa;
	struct apparmor_audit_data aad = {0,};
	COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_CAP);
	sa.type = LSM_AUDIT_DATA_CAP;
	sa.aad = &aad;
	sa.u.cap = cap;
	sa.aad->tsk = task;
+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ int aa_audit_file(struct aa_profile *profile, struct file_perms *perms,
	int type = AUDIT_APPARMOR_AUTO;
	struct common_audit_data sa;
	struct apparmor_audit_data aad = {0,};
	COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE);
	sa.type = LSM_AUDIT_DATA_NONE;
	sa.aad = &aad;
	aad.op = op,
	aad.fs.request = request;
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ static int aa_audit_ptrace(struct aa_profile *profile,
{
	struct common_audit_data sa;
	struct apparmor_audit_data aad = {0,};
	COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE);
	sa.type = LSM_AUDIT_DATA_NONE;
	sa.aad = &aad;
	aad.op = OP_PTRACE;
	aad.target = target;
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ void aa_info_message(const char *str)
	if (audit_enabled) {
		struct common_audit_data sa;
		struct apparmor_audit_data aad = {0,};
		COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE);
		sa.type = LSM_AUDIT_DATA_NONE;
		sa.aad = &aad;
		aad.info = str;
		aa_audit_msg(AUDIT_APPARMOR_STATUS, &sa, NULL);
Loading