]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
audit: mark audit_log_vformat() with __printf() attribute
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 13 Mar 2025 08:52:39 +0000 (10:52 +0200)
committerPaul Moore <paul@paul-moore.com>
Fri, 11 Apr 2025 17:57:22 +0000 (13:57 -0400)
audit_log_vformat() is using printf() type of format, and GCC compiler
(Debian 14.2.0-17) is not happy about this:

kernel/audit.c:1978:9: error: function ‘audit_log_vformat’
  might be a candidate for ‘gnu_printf’ format attribute
kernel/audit.c:1987:17: error: function ‘audit_log_vformat’
  might be a candidate for ‘gnu_printf’ format attribute

Fix the compilation errors (`make W=1` when CONFIG_WERROR=y, which is
default) by adding __printf() attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[PM: commit description line wrap fixes]
Signed-off-by: Paul Moore <paul@paul-moore.com>
kernel/audit.c

index 5f5bf85bcc905c9215006e0936947737ecf1dc41..f365e1bbeac64fe3024e6ef6a01a0cdcc8bbb984 100644 (file)
@@ -1956,8 +1956,8 @@ static inline int audit_expand(struct audit_buffer *ab, int extra)
  * will be called a second time.  Currently, we assume that a printk
  * can't format message larger than 1024 bytes, so we don't either.
  */
-static void audit_log_vformat(struct audit_buffer *ab, const char *fmt,
-                             va_list args)
+static __printf(2, 0)
+void audit_log_vformat(struct audit_buffer *ab, const char *fmt, va_list args)
 {
        int len, avail;
        struct sk_buff *skb;