lkml.org 
[lkml]   [2021]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ath10k: fix invalid dma_addr_t token assignment
On 14/10/2021 04:51, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Using a kernel pointer in place of a dma_addr_t token can
> lead to undefined behavior if that makes it into cache
> management functions. The compiler caught one such attempt
> in a cast:
>
> drivers/net/wireless/ath/ath10k/mac.c: In function
> 'ath10k_add_interface':
> drivers/net/wireless/ath/ath10k/mac.c:5586:47: error: cast from
> pointer to integer of different size [-Werror=pointer-to-int-cast]
> 5586 | arvif->beacon_paddr =
> (dma_addr_t)arvif->beacon_buf;
> | ^
>
> Looking through how this gets used down the way, I'm fairly
> sure that beacon_paddr is never accessed again for ATH10K_DEV_TYPE_HL
> devices, and if it was accessed, that would be a bug.
>
> Change the assignment to use a known-invalid address token
> instead, which avoids the warning and makes it easier to catch
> bugs if it does end up getting used.
>
> Fixes: e263bdab9c0e ("ath10k: high latency fixes for beacon buffer")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Fabio Estevam <festevam@denx.de>

\
 
 \ /
  Last update: 2021-10-25 14:17    [W:0.055 / U:0.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site