OSDN Git Service

ipw2x00: Use struct_size helper instead of open-coded arithmetic
authorLen Baker <len.baker@gmx.com>
Sat, 17 Jul 2021 14:25:13 +0000 (16:25 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 21 Aug 2021 17:15:15 +0000 (20:15 +0300)
commit6f78f4a41ee0c348af73ed054ccff2d9c9c17cdb
treea7e52aae3f3729e1ea8e0ce6c209999e1a12612e
parent502213fd8fca00fe7ebaf9a147c5038c91738cb5
ipw2x00: Use struct_size helper instead of open-coded arithmetic

Dynamic size calculations (especially multiplication) should not be
performed in memory allocator function arguments due to the risk of them
overflowing. This could lead to values wrapping around and a smaller
allocation being made than the caller was expecting. Using those
allocations could lead to linear overflows of heap memory and other
misbehaviors.

To avoid this scenario, use the struct_size helper.

Signed-off-by: Len Baker <len.baker@gmx.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210717142513.5411-1-len.baker@gmx.com
drivers/net/wireless/intel/ipw2x00/libipw_tx.c