linux_dsm_epyc7002/drivers/usb/wusbcore
Gustavo A. R. Silva 225b3dc92d USB: wusbcore: crypto: Remove VLA usage
In preparation to enabling -Wvla, remove VLA and replace it
with dynamic memory allocation instead.

The use of stack Variable Length Arrays needs to be avoided, as they
can be a vector for stack exhaustion, which can be both a runtime bug
or a security flaw. Also, in general, as code evolves it is easy to
lose track of how big a VLA can get. Thus, we can end up having runtime
failures that are hard to debug.

Also, fixed as part of the directive to remove all VLAs from
the kernel: https://lkml.org/lkml/2018/3/7/621

Notice that in this particular case, an alternative to kzalloc is kcalloc,
in which case the code would look as follows instead:

iv = kcalloc(crypto_skcipher_ivsize(tfm_cbc), sizeof(*iv), GFP_KERNEL);

but if the data type of _iv_ never changes, or the type size is always one
byte, kzalloc is good enough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-16 15:40:19 +01:00
..
cbaf.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
crypto.c USB: wusbcore: crypto: Remove VLA usage 2018-03-16 15:40:19 +01:00
dev-sysfs.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
devconnect.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
Kconfig usb: wusbcore: USB_WUSB_CBAF depends on USB 2014-09-23 22:06:33 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmc.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
pal.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
reservation.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
rh.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
security.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
wa-hc.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
wa-hc.h USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
wa-nep.c USB: wusbcore: remove redundant re-assignment to pointer 'dev' 2018-03-09 09:16:19 -08:00
wa-rpipe.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
wa-xfer.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
wusbhc.c USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00
wusbhc.h USB: wusbcore: Remove redundant license text 2017-11-07 15:45:01 +01:00