mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 08:31:55 +00:00
07e7f36da8
As noted in the "Deprecated Interfaces, Language Features, Attributes, and Conventions" documentation [1], size calculations (especially multiplication) should not be performed in memory allocator (or similar) 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. In this case these aren't actually dynamic sizes: both sides of the multiplication are constant values. However it is best to refactor these anyway, just to keep the open-coded math idiom out of code. So, use the purpose specific kcalloc() function instead of the argument size * count in the kzalloc() function. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Len Baker <len.baker@gmx.com> Link: https://lore.kernel.org/r/20210824090039.GA7999@titan Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
||
---|---|---|
.. | ||
ieee80211 | ||
authors | ||
changes | ||
Kconfig | ||
Makefile | ||
r819xU_cmdpkt.c | ||
r819xU_cmdpkt.h | ||
r819xU_firmware_img.c | ||
r819xU_firmware_img.h | ||
r819xU_firmware.c | ||
r819xU_firmware.h | ||
r819xU_phy.c | ||
r819xU_phy.h | ||
r819xU_phyreg.h | ||
r8180_93cx6.c | ||
r8180_93cx6.h | ||
r8190_rtl8256.c | ||
r8190_rtl8256.h | ||
r8192U_core.c | ||
r8192U_dm.c | ||
r8192U_dm.h | ||
r8192U_hw.h | ||
r8192U_wx.c | ||
r8192U_wx.h | ||
r8192U.h |