Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3615001rdb; Wed, 13 Sep 2023 18:44:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBYvhPecG0XotOKpFKUxARbRcflQefWWzZzTgLtuNJE+jKFZty77gV+dF6vjbyt5G5J/e/ X-Received: by 2002:a05:620a:c0c:b0:76f:582:b080 with SMTP id l12-20020a05620a0c0c00b0076f0582b080mr3579402qki.71.1694655874591; Wed, 13 Sep 2023 18:44:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694655874; cv=none; d=google.com; s=arc-20160816; b=UkcVQngJCdplbfWl41Ush/E/hGPpdVI2VNaC2wrwbtyyu+avPS5L0k8cL6YHv0Dl/6 93nBQIaEleqq/cP13LuznA8KQaw5k1H/z7fsk8mbUF73UT2NL/p4Qv8WXfmCrNipsHTt WXXRPh4Yt6hI1PHdvjovAZaSQwtp2yH5NyH2XjrgX3A+JBuqYA6S+IuJpocA/QP7Mrfn n4Hes1/2qu08zrmvSAdIScbqb/boiP18VfNCUVv9SsDCtb/PAQooJVSojVJwSgHbQ5L+ 3wRBq4hGdQPZpoUoEvc9jpCnNCr6dPLh6klNiV870fX85/7mzAynStvQFYCKVQQxnZJn M64A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=4nr4M9eWXuJbF3CGSnOxqmcLPW+v0w05dIGAm42XF2A=; fh=4hWYXOZPVnsazVJtA2U9efwFkVrBftMezeKsFlHg7DA=; b=jL2Fyv1mCEA0Ow0cO4qPx9mSu5e22qhObiVSLof7+RZ7PIwaG7a0Xj3cuOrVsJNWEW MTthaAI48v/4fOT1g1lRBbL5AdB3MaNKceOaP0gssvU9KHXnzNNDDCItD2lCR/Ryj9ip Q/DfxBSvdBoLksAfVF8w4u3mm3gW0rzHYy0p6F2qXOATHaHIg5Gj6zJPMA3nEUTwdEo1 Mr09PSG/7xk/n13ha5Bf0P1BuIuo7TXgKiYbYc5ngf/j1uN3OhBFc+DhK99hg4ub4+wp ooJd65yNwvaT2LrJERN5Kw3VtBnnWZtkbtrhof8u+wpWET0PaGVDPdTaA8EebDj7YvyH yKDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=iThkq4cZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bq25-20020a056a000e1900b0068fb2dfe679si481789pfb.355.2023.09.13.18.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 18:44:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=iThkq4cZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3832A803202E; Tue, 12 Sep 2023 14:25:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232442AbjILVZG (ORCPT + 99 others); Tue, 12 Sep 2023 17:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231528AbjILVZF (ORCPT ); Tue, 12 Sep 2023 17:25:05 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6290B10CC; Tue, 12 Sep 2023 14:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1694553899; bh=troU+PLlpwci323/gDB4WCiWvfP0ri6UwPZrciYRTEw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iThkq4cZawFuSxlPgoouuVennh3f97hIHInNKMBu6XYDe3UlW1FikkCUe78qF2ZYC cdyWAOnmijSQx7DBPSP2s/jiY4J9LwpVJDPsCoeNIj90b/d0aeA6D91LBu+vYqJP+b uqRWIlsIeSTdakfpghyVSwduCagA9WphDjW/Hc+U= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 12 Sep 2023 23:24:43 +0200 Subject: [PATCH 4/5] bcachefs: Add printf function attributes MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230912-bcachefs-cleanup-v1-4-c1f717424e6a@weissschuh.net> References: <20230912-bcachefs-cleanup-v1-0-c1f717424e6a@weissschuh.net> In-Reply-To: <20230912-bcachefs-cleanup-v1-0-c1f717424e6a@weissschuh.net> To: Kent Overstreet , Brian Foster Cc: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694553898; l=2069; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=troU+PLlpwci323/gDB4WCiWvfP0ri6UwPZrciYRTEw=; b=UK0IJW37miCSEW8yO3EoCxvTRteZPjU10AFlPnPVJvMYtlcq72U7XIE/0JVsNjtbVPc3H+vEW XgvSvjFN426BbdhG0LXoxQDwbwc6c5+m6R8OoVWKAL+8bWKY/JFtPXK X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Sep 2023 14:25:07 -0700 (PDT) These help the compiler detect incorrect use of format strings and their arguments. Signed-off-by: Thomas Weißschuh --- 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 + #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