summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8723bs
diff options
context:
space:
mode:
authorLen Baker <len.baker@gmx.com>2021-08-24 11:00:39 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-08-26 12:14:27 +0200
commit07e7f36da8abb4563d145399270c0b92f8d79ff7 (patch)
treecf81a2804d51216f8ae48d769e5841d710f17dba /drivers/staging/rtl8723bs
parentc4b30776bf2941e0d17d3f164e54e553b2456888 (diff)
staging/rtl8192u: Prefer kcalloc over open coded arithmetic
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>
Diffstat (limited to 'drivers/staging/rtl8723bs')
0 files changed, 0 insertions, 0 deletions