lkml.org 
[lkml]   [2022]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] drivers: lkdtm: fix clang -Wformat warning
On Thu, Jul 21, 2022 at 2:20 PM Justin Stitt <justinstitt@google.com> wrote:
>
> When building with Clang we encounter the following warning
> (ARCH=hexagon + CONFIG_FRAME_WARN=0):
> | ../drivers/misc/lkdtm/bugs.c:107:3: error: format specifies type
> | 'unsigned long' but the argument has type 'int' [-Werror,-Wformat]
> | REC_STACK_SIZE, recur_count);
> | ^~~~~~~~~~~~~~
>
> Cast REC_STACK_SIZE to `unsigned long` to match format specifier `%lu`.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Justin Stitt <justinstitt@google.com>
> ---
> Reported by Nathan here:
> https://lore.kernel.org/all/YtmrCJjQrSbv8Aj1@dev-arch.thelio-3990X/
>
> drivers/misc/lkdtm/bugs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c
> index 009239ad1d8a..6381255aaecc 100644
> --- a/drivers/misc/lkdtm/bugs.c
> +++ b/drivers/misc/lkdtm/bugs.c
> @@ -29,7 +29,7 @@ struct lkdtm_list {
> #if defined(CONFIG_FRAME_WARN) && (CONFIG_FRAME_WARN > 0)
> #define REC_STACK_SIZE (_AC(CONFIG_FRAME_WARN, UL) / 2)
> #else
> -#define REC_STACK_SIZE (THREAD_SIZE / 8)
> +#define REC_STACK_SIZE ((unsigned long)(THREAD_SIZE / 8))

`THREAD_SIZE / 8UL` might be more concise.

> #endif
> #define REC_NUM_DEFAULT ((THREAD_SIZE / REC_STACK_SIZE) * 2)
>
> --
> 2.37.1.359.gd136c6c3e2-goog
>


--
Thanks,
~Nick Desaulniers

\
 
 \ /
  Last update: 2022-07-21 23:45    [W:0.050 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site