[RFC PATCH] audit: drop BUG_ON() from audit_log_XXX()
Paul Moore <[email protected]> Tue, 30 Jun 2026 15:52:43 -0400
| Newsgroups | org.kernel.vger.audit |
|---|---|
| Message-ID | <[email protected]> |
We can easily drop the BUG_ON()s from the audit_log_XXX() helpers and simply return to the caller as we do if we are passed a NULL audit_buffer. Signed-off-by: Paul Moore <[email protected]> --- kernel/audit.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/audit.c b/kernel/audit.c index dcc657d35776..d05c92d74361 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -2016,10 +2016,9 @@ void audit_log_vformat(struct audit_buffer *ab, const char *fmt, va_list args) struct sk_buff *skb; va_list args2; - if (!ab) + if (!ab || !ab->skb) return; - BUG_ON(!ab->skb); skb = ab->skb; avail = skb_tailroom(skb); if (avail == 0) { @@ -2084,10 +2083,9 @@ void audit_log_n_hex(struct audit_buffer *ab, const unsigned char *buf, unsigned char *ptr; struct sk_buff *skb; - if (!ab) + if (!ab || !ab->skb) return; - BUG_ON(!ab->skb); skb = ab->skb; avail = skb_tailroom(skb); new_len = len<<1; @@ -2117,10 +2115,9 @@ void audit_log_n_string(struct audit_buffer *ab, const char *string, unsigned char *ptr; struct sk_buff *skb; - if (!ab) + if (!ab || !ab->skb) return; - BUG_ON(!ab->skb); skb = ab->skb; avail = skb_tailroom(skb); new_len = slen + 3; /* enclosing quotes + null terminator */ -- 2.55.0