usb: gadget: Zero ffs_io_data
authorAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Mon, 3 Jun 2019 17:05:28 +0000 (19:05 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 18 Jun 2019 08:58:29 +0000 (11:58 +0300)
commit508595515f4bcfe36246e4a565cf280937aeaade
tree9ac3c5d813f03592bad53fe56ca1cb6923c5b662
parent48f5e7493a6a0ac2cf6cf41835495a1f67f4a57c
usb: gadget: Zero ffs_io_data

In some cases the "Allocate & copy" block in ffs_epfile_io() is not
executed. Consequently, in such a case ffs_alloc_buffer() is never called
and struct ffs_io_data is not initialized properly. This in turn leads to
problems when ffs_free_buffer() is called at the end of ffs_epfile_io().

This patch uses kzalloc() instead of kmalloc() in the aio case and memset()
in non-aio case to properly initialize struct ffs_io_data.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_fs.c