lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230912-bcachefs-cleanup-v1-4-c1f717424e6a@weissschuh.net>
Date:   Tue, 12 Sep 2023 23:24:43 +0200
From:   Thomas Weißschuh <linux@...ssschuh.net>
To:     Kent Overstreet <kent.overstreet@...ux.dev>,
        Brian Foster <bfoster@...hat.com>
Cc:     linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org,
        Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 4/5] bcachefs: Add printf function attributes

These help the compiler detect incorrect use of format strings and their
arguments.

Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
 fs/bcachefs/btree_io.c     | 1 +
 fs/bcachefs/btree_update.c | 2 ++
 fs/bcachefs/btree_update.h | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 8655a07456e6..bfaaa6b612ad 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -542,6 +542,7 @@ static void btree_err_msg(struct printbuf *out, struct bch_fs *c,
 	prt_str(out, ": ");
 }
 
+__printf(8, 9)
 static int __btree_err(int ret,
 		       struct bch_fs *c,
 		       struct bch_dev *ca,
diff --git a/fs/bcachefs/btree_update.c b/fs/bcachefs/btree_update.c
index 3dcb05b51e2d..cf0415e93feb 100644
--- a/fs/bcachefs/btree_update.c
+++ b/fs/bcachefs/btree_update.c
@@ -818,6 +818,7 @@ int bch2_btree_bit_mod(struct btree_trans *trans, enum btree_id btree,
 	return bch2_trans_update_buffered(trans, btree, k);
 }
 
+__printf(2, 0)
 static int __bch2_trans_log_msg(darray_u64 *entries, const char *fmt, va_list args)
 {
 	struct printbuf buf = PRINTBUF;
@@ -854,6 +855,7 @@ static int __bch2_trans_log_msg(darray_u64 *entries, const char *fmt, va_list ar
 	return ret;
 }
 
+__printf(3, 0)
 static int
 __bch2_fs_log_msg(struct bch_fs *c, unsigned commit_flags, const char *fmt,
 		  va_list args)
diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h
index c6ab11c76cc3..13a47aac9b81 100644
--- a/fs/bcachefs/btree_update.h
+++ b/fs/bcachefs/btree_update.h
@@ -2,6 +2,8 @@
 #ifndef _BCACHEFS_BTREE_UPDATE_H
 #define _BCACHEFS_BTREE_UPDATE_H
 
+#include <linux/compiler.h>
+
 #include "btree_iter.h"
 #include "journal.h"
 #include "journal.h"
@@ -114,6 +116,7 @@ void bch2_trans_commit_hook(struct btree_trans *,
 			    struct btree_trans_commit_hook *);
 int __bch2_trans_commit(struct btree_trans *, unsigned);
 
+__printf(2, 3)
 int bch2_journal_log_msg(struct bch_fs *, const char *, ...);
 
 /**

-- 
2.42.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ