]> asedeno.scripts.mit.edu Git - linux.git/commit
usb: wusbcore: wa-xfer: use struct_size() helper
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 18 Feb 2019 20:21:53 +0000 (14:21 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Feb 2019 13:41:38 +0000 (14:41 +0100)
commit01bdf01c7ba8cfdbe205c664f0fd6f9b6f586195
treefc3a5093c2f64a7e6b70bf533b9add2309f5799e
parent5ebf5c890324ffa5eaca579dac6913f3e29a28e3
usb: wusbcore: wa-xfer: use struct_size() helper

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.

So, change the following form:

sizeof(*packet_desc) + (sizeof(packet_desc->PacketLength[0]) * seg->isoc_frame_count)

to :

struct_size(packet_status, PacketStatus, seg->isoc_frame_count);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/wusbcore/wa-xfer.c