merged to linux-yocto-dev standard/* and linux-yocto v5.8/standard/*

Bruce


In message: [linux-yocto] [standard/base] [PATCH] arm64/perf: Fix wrong cast 
that may cause wrong truncation
on 21/08/2020 [email protected] wrote:

> From: He Zhe <[email protected]>
> 
> tail is a pointer while buftail.fp is a u32.
> 
> arch/arm64/kernel/perf_callchain.c:100:6: warning: cast from pointer to
> integer of different size [-Wpointer-to-int-cast]
>   100 |  if ((u32)tail + 4 >= buftail.fp)
>       |      ^
> arch/arm64/kernel/perf_callchain.c:103:9: warning: cast to pointer from
> integer of different size [-Wint-to-pointer-cast]{noformat}
>   103 |  return (struct compat_frame_tail __user *)(buftail.fp - 4);
>       |         ^
> 
> Fixes: 8818670c17d2 ("arm64/perf: fix backtrace for AAPCS with FP enabled")
> Signed-off-by: He Zhe <[email protected]>
> ---
>  arch/arm64/kernel/perf_callchain.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/perf_callchain.c 
> b/arch/arm64/kernel/perf_callchain.c
> index 1be96e3631ea..a4b0864c4e32 100644
> --- a/arch/arm64/kernel/perf_callchain.c
> +++ b/arch/arm64/kernel/perf_callchain.c
> @@ -97,10 +97,10 @@ compat_user_backtrace(struct compat_frame_tail __user 
> *tail,
>        * Frame pointers should strictly progress back up the stack
>        * (towards higher addresses).
>        */
> -     if ((u32)tail + 4 >= buftail.fp)
> +     if ((u64)tail + 4 >= (u64)buftail.fp)
>               return NULL;
>  
> -     return (struct compat_frame_tail __user *)(buftail.fp - 4);
> +     return (struct compat_frame_tail __user *)((u64)buftail.fp - 4);
>  }
>  #endif /* CONFIG_COMPAT */
>  
> -- 
> 2.17.1
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#8985): 
https://lists.yoctoproject.org/g/linux-yocto/message/8985
Mute This Topic: https://lists.yoctoproject.org/mt/76312403/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to