]> git.baikalelectronics.ru Git - kernel.git/commit
ath10k: fix pointer arithmetic error in trace call
authorFrancesco Magliocca <franciman12@gmail.com>
Mon, 21 Feb 2022 12:26:38 +0000 (13:26 +0100)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 24 Feb 2022 09:05:10 +0000 (11:05 +0200)
commit3a47c177102c33f320454d0f7179f348eb4e1e54
tree4d591a11b46f816295e74467de76992b8de14960
parent2473ca6a1c26a20991cc27c58f2600afdce2005b
ath10k: fix pointer arithmetic error in trace call

Reading through the commit history, it looks like
there is no special need why we must skip the first 4 bytes
in this trace call:

trace_ath10k_htt_rx_desc(ar, (void*)rx_desc + sizeof(u32),
 hw->rx_desc_ops->rx_desc_size - sizeof(u32));

found in the function ath10k_htt_rx_amsdu_pop in the file htt_rx.c

i think the original author
(who is also the one who added rx_desc tracing capabilities
in c11b838d3e42) just wanted to trace the rx_desc contents,
ignoring the fw_rx_desc_base info field
(which is the part being skipped over).
But the trace_ath10k_htt_rx_desc later added
don't care about skipping it, so it may be good
to uniform this call to the others in the file.
But this would change the output of the trace and
thus it may be a problem for tools that rely on it.
Therefore I propose until further discussion
to just keep it as it is and just fix the pointer arithmetic bug.

Add missing void* cast to rx descriptor pointer in order to
properly skip the initial 4 bytes of the rx descriptor
when passing it to trace_ath10k_htt_rx_desc trace function.

This fixes the pointer arithmetic error detected
by Dan Carpenter's static analysis tool.

Fixes: d57a9ad8eb82 ("ath10k: abstract htt_rx_desc structure")
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1

Signed-off-by: Francesco Magliocca <franciman12@gmail.com>
Link: https://lore.kernel.org/ath10k/20220201130900.GD22458@kili/
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220221122638.7971-1-franciman12@gmail.com
drivers/net/wireless/ath/ath10k/htt_rx.c