]> www.infradead.org Git - users/dwmw2/linux.git/commit
usb: gadget: s3c-hsudc: Use struct_size() in devm_kzalloc()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Thu, 13 May 2021 19:33:53 +0000 (14:33 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 May 2021 12:05:27 +0000 (14:05 +0200)
commit106133dacc001e4e3a7ebcdb96368f523bf44a89
treee6b6920b26eff5607f57e44793841b1dc887ce6a
parent53ad92fdf7c34c3b44566553077176a767612454
usb: gadget: s3c-hsudc: Use struct_size() in devm_kzalloc()

Make use of the struct_size() helper instead of an open-coded version,
in order to avoid any potential type mistakes or integer overflows
that, in the worse scenario, could lead to heap overflows.

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20210513193353.GA196565@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/s3c-hsudc.c