[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAO9qdTHt2vSRhajEYEsaTJRB8yi_5sjLUq12W=8uKf=DnX6PSA@mail.gmail.com>
Date: Mon, 26 May 2025 20:53:14 +0900
From: Jeongjun Park <aha310510@...il.com>
To: Pan Taixi <pantaixi@...weicloud.com>
Cc: pantaixi1@...wei.com, rostedt@...dmis.org, mhiramat@...nel.org,
mathieu.desnoyers@...icios.com, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, yeweihua4@...wei.com
Subject: Re: [PATCH] tracing: Fix compilation warning on arm32
Pan Taixi <pantaixi@...weicloud.com> wrote:
>
> On arm32, size_t is defined to be unsigned int, while PAGE_SIZE is
> unsigned long. This hence triggers a compilation warning as min()
> asserts the type of two operands to be equal. Casting PAGE_SIZE to size_t
> solves this issue and works on other target architectures as well.
>
Thanks! I forgot to cast PAGE_SIZE to size_t
Reviewed-by: Jeongjun Park <aha310510@...il.com>
> Compilation warning details:
>
> kernel/trace/trace.c: In function 'tracing_splice_read_pipe':
> ./include/linux/minmax.h:20:28: warning: comparison of distinct pointer types lacks a cast
> (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
> ^
> ./include/linux/minmax.h:26:4: note: in expansion of macro '__typecheck'
> (__typecheck(x, y) && __no_side_effects(x, y))
> ^~~~~~~~~~~
>
> ...
>
> kernel/trace/trace.c:6771:8: note: in expansion of macro 'min'
> min((size_t)trace_seq_used(&iter->seq),
> ^~~
>
> Fixes: f5178c41bb43 ("tracing: Fix oob write in trace_seq_to_buffer()")
> Signed-off-by: Pan Taixi <pantaixi@...weicloud.com>
> ---
> kernel/trace/trace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 5b8db27fb6ef..766cb3cd254e 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -6824,7 +6824,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
> ret = trace_seq_to_buffer(&iter->seq,
> page_address(spd.pages[i]),
> min((size_t)trace_seq_used(&iter->seq),
> - PAGE_SIZE));
> + (size_t)PAGE_SIZE));
> if (ret < 0) {
> __free_page(spd.pages[i]);
> break;
> --
> 2.34.1
>
Powered by blists - more mailing lists