Commit bd1741f4 authored by Stephen Smalley's avatar Stephen Smalley Committed by Paul Moore

selinux: Augment BUG_ON assertion for secclass_map.

Ensure that we catch any cases where tclass == 0.
Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: default avatarPaul Moore <pmoore@redhat.com>
parent 5dee25d0
...@@ -116,6 +116,7 @@ static void avc_dump_av(struct audit_buffer *ab, u16 tclass, u32 av) ...@@ -116,6 +116,7 @@ static void avc_dump_av(struct audit_buffer *ab, u16 tclass, u32 av)
return; return;
} }
BUG_ON(!tclass || tclass >= ARRAY_SIZE(secclass_map));
perms = secclass_map[tclass-1].perms; perms = secclass_map[tclass-1].perms;
audit_log_format(ab, " {"); audit_log_format(ab, " {");
...@@ -164,7 +165,7 @@ static void avc_dump_query(struct audit_buffer *ab, u32 ssid, u32 tsid, u16 tcla ...@@ -164,7 +165,7 @@ static void avc_dump_query(struct audit_buffer *ab, u32 ssid, u32 tsid, u16 tcla
kfree(scontext); kfree(scontext);
} }
BUG_ON(tclass >= ARRAY_SIZE(secclass_map)); BUG_ON(!tclass || tclass >= ARRAY_SIZE(secclass_map));
audit_log_format(ab, " tclass=%s", secclass_map[tclass-1].name); audit_log_format(ab, " tclass=%s", secclass_map[tclass-1].name);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment