Skip to content

Commit bd1741f

Browse files
stephensmalleypcmoore
authored andcommitted
selinux: Augment BUG_ON assertion for secclass_map.
Ensure that we catch any cases where tclass == 0. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Paul Moore <pmoore@redhat.com>
1 parent 5dee25d commit bd1741f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎security/selinux/avc.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ static void avc_dump_av(struct audit_buffer *ab, u16 tclass, u32 av)
116116
return;
117117
}
118118

119+
BUG_ON(!tclass || tclass >= ARRAY_SIZE(secclass_map));
119120
perms = secclass_map[tclass-1].perms;
120121

121122
audit_log_format(ab, " {");
@@ -164,7 +165,7 @@ static void avc_dump_query(struct audit_buffer *ab, u32 ssid, u32 tsid, u16 tcla
164165
kfree(scontext);
165166
}
166167

167-
BUG_ON(tclass >= ARRAY_SIZE(secclass_map));
168+
BUG_ON(!tclass || tclass >= ARRAY_SIZE(secclass_map));
168169
audit_log_format(ab, " tclass=%s", secclass_map[tclass-1].name);
169170
}
170171

0 commit comments

Comments
 (0)