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: <20230913214257.vsjt5qrpa57sjcg7@google.com>
Date:   Wed, 13 Sep 2023 21:42:57 +0000
From:   Justin Stitt <justinstitt@...gle.com>
To:     Nathan Chancellor <nathan@...nel.org>
Cc:     kent.overstreet@...ux.dev, bfoster@...hat.com,
        linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev, patches@...ts.linux.dev
Subject: Re: [PATCH 1/7] bcachefs: Fix -Wformat in
 bch2_set_bucket_needs_journal_commit()

On Tue, Sep 12, 2023 at 12:15:38PM -0700, Nathan Chancellor wrote:
> When building bcachefs for 32-bit ARM, there is a compiler warning in
> bch2_set_bucket_needs_journal_commit() due to a debug print using the
> wrong specifier:
>
>   fs/bcachefs/buckets_waiting_for_journal.c:137:30: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigned long' [-Werror,-Wformat]
>     136 |         pr_debug("took %zu rehashes, table at %zu/%zu elements",
>         |                                                   ~~~
>         |                                                   %lu
>     137 |                  nr_rehashes, nr_elements, 1UL << b->t->bits);
>         |                                            ^~~~~~~~~~~~~~~~~
>   include/linux/printk.h:579:26: note: expanded from macro 'pr_debug'
>     579 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
>         |                          ~~~    ^~~~~~~~~~~
>   include/linux/dynamic_debug.h:270:22: note: expanded from macro 'dynamic_pr_debug'
>     270 |                            pr_fmt(fmt), ##__VA_ARGS__)
>         |                                   ~~~     ^~~~~~~~~~~
>   include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
>     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
>         |                                                                  ^~~~~~~~~~~
>   include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
>     248 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
>         |                                                                        ^~~~~~~~~~~
>   include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
>     224 |                 func(&id, ##__VA_ARGS__);                       \
>         |                             ^~~~~~~~~~~
>   1 error generated.
>
> On 64-bit architectures, size_t is 'unsigned long', so there is no
> warning when using %zu but on 32-bit architectures, size_t is
> 'unsigned int'. Use the correct specifier to resolve the warning.
>
> Fixes: 7a82e75ddaef ("bcachefs: New data structure for buckets waiting on journal commit")
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
Reviewed-by: Justin Stitt <justinstitt@...gle.com>

> ---
>  fs/bcachefs/buckets_waiting_for_journal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/bcachefs/buckets_waiting_for_journal.c b/fs/bcachefs/buckets_waiting_for_journal.c
> index 81ab685cdef9..ec1b636ef78d 100644
> --- a/fs/bcachefs/buckets_waiting_for_journal.c
> +++ b/fs/bcachefs/buckets_waiting_for_journal.c
> @@ -133,7 +133,7 @@ int bch2_set_bucket_needs_journal_commit(struct buckets_waiting_for_journal *b,
>  	b->t = n;
>  	kvfree(t);
>
> -	pr_debug("took %zu rehashes, table at %zu/%zu elements",
> +	pr_debug("took %zu rehashes, table at %zu/%lu elements",
>  		 nr_rehashes, nr_elements, 1UL << b->t->bits);
>  out:
>  	mutex_unlock(&b->lock);
>
> --
> 2.42.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ