[lvc-project] [PATCH] wifi: brcmfmac: Fix allocation size
Kalle Valo
kvalo at kernel.org
Wed Jan 18 06:59:28 MSK 2023
"Alexey V. Vissarionov" <gremlin at altlinux.org> writes:
> On 2023-01-17 13:05:24 +0200, Kalle Valo wrote:
>
> >> - buf_size += (max_idx + 1) * sizeof(pkt);
> >> + buf_size += (max_idx + 1) * sizeof(struct sk_buff);
> > Wouldn't sizeof(*pkt) be better?
>
> Usually sizeof(type) produces less errors than sizeof(var)...
This matter of taste really but FWIW I prefer sizeof(var) as then the
type can't be different by accident. And the coding style says something
similar, although that's related to memory allocation:
https://www.kernel.org/doc/html/latest/process/coding-style.html#allocating-memory
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
More information about the lvc-project
mailing list