public inbox for audit@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] audit: Mark audit_log_vformat() with __printf() attribute
@ 2025-03-13  8:52 Andy Shevchenko
  2025-03-20 15:19 ` Andy Shevchenko
  2025-03-20 22:02 ` Paul Moore
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-03-13  8:52 UTC (permalink / raw)
  To: Paul Moore, Casey Schaufler, audit, linux-kernel
  Cc: Eric Paris, Andy Shevchenko

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 [-Werror=suggest-attribute=format]
kernel/audit.c:1987:17: error: function ‘audit_log_vformat’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]

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>
---

v2: added necessary technical information to the commit message (Paul)

 kernel/audit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 5f5bf85bcc90..f365e1bbeac6 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -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;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] audit: Mark audit_log_vformat() with __printf() attribute
  2025-03-13  8:52 [PATCH v2 1/1] audit: Mark audit_log_vformat() with __printf() attribute Andy Shevchenko
@ 2025-03-20 15:19 ` Andy Shevchenko
  2025-03-20 22:02 ` Paul Moore
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-03-20 15:19 UTC (permalink / raw)
  To: Paul Moore, Casey Schaufler, audit, linux-kernel; +Cc: Eric Paris

On Thu, Mar 13, 2025 at 10:52:39AM +0200, Andy Shevchenko wrote:
> 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 [-Werror=suggest-attribute=format]
> kernel/audit.c:1987:17: error: function ‘audit_log_vformat’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> 
> Fix the compilation errors (`make W=1` when CONFIG_WERROR=y, which is default)
> by adding __printf() attribute.

Any comments on this? Can it be applied?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] audit: Mark audit_log_vformat() with __printf()  attribute
  2025-03-13  8:52 [PATCH v2 1/1] audit: Mark audit_log_vformat() with __printf() attribute Andy Shevchenko
  2025-03-20 15:19 ` Andy Shevchenko
@ 2025-03-20 22:02 ` Paul Moore
  2025-04-11 18:03   ` Paul Moore
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Moore @ 2025-03-20 22:02 UTC (permalink / raw)
  To: Andy Shevchenko, Casey Schaufler, audit, linux-kernel
  Cc: Eric Paris, Andy Shevchenko

On Mar 13, 2025 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> 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 [-Werror=suggest-attribute=format]
> kernel/audit.c:1987:17: error: function ‘audit_log_vformat’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> 
> 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>
> ---
> v2: added necessary technical information to the commit message (Paul)
> 
>  kernel/audit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Merged into audit/dev-staging, this will move to audit/dev after the
upcoming merge window.

--
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] audit: Mark audit_log_vformat() with __printf() attribute
  2025-03-20 22:02 ` Paul Moore
@ 2025-04-11 18:03   ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2025-04-11 18:03 UTC (permalink / raw)
  To: Andy Shevchenko, Casey Schaufler, audit, linux-kernel; +Cc: Eric Paris

On Thu, Mar 20, 2025 at 6:02 PM Paul Moore <paul@paul-moore.com> wrote:
> On Mar 13, 2025 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >
> > 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 [-Werror=suggest-attribute=format]
> > kernel/audit.c:1987:17: error: function ‘audit_log_vformat’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> >
> > 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>
> > ---
> > v2: added necessary technical information to the commit message (Paul)
> >
> >  kernel/audit.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Merged into audit/dev-staging, this will move to audit/dev after the
> upcoming merge window.

... and now it is in audit/dev, thanks.

-- 
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-11 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13  8:52 [PATCH v2 1/1] audit: Mark audit_log_vformat() with __printf() attribute Andy Shevchenko
2025-03-20 15:19 ` Andy Shevchenko
2025-03-20 22:02 ` Paul Moore
2025-04-11 18:03   ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox