ath10k: coredump: use struct_size() helper
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 3 Apr 2019 19:06:36 +0000 (14:06 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 7 May 2019 13:52:39 +0000 (16:52 +0300)
commit4f735cd73650d8136f8bd78dca8f61f361791622
tree26956aded963dba6c7e8b510d5c77f714dc3eafc
parent35b50e70df272a4b4d313b7042e386445c98f06d
ath10k: coredump: use struct_size() helper

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.

So, replace code of the following form:

sizeof(*ce_hdr) + CE_COUNT * sizeof(ce_hdr->entries[0])

with:

struct_size(ce_hdr, entries, CE_COUNT)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath10k/coredump.c