staging: usbip: use kcalloc instead of kzalloc for array allocations

The advantage of kcalloc is, that will prevent integer overflows which could
result from the multiplication of number of elements and size and it is also
a bit nicer to read.

Signed-off-by: Djordje Zekovic <dj@zeko.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Djordje Zekovic 2014-05-23 14:18:03 +00:00 committed by Greg Kroah-Hartman
parent 43339bed70
commit 6baf139e8b
1 changed files with 1 additions and 1 deletions

View File

@ -179,7 +179,7 @@ static int stub_send_ret_submit(struct stub_device *sdev)
else
iovnum = 2;
iov = kzalloc(iovnum * sizeof(struct kvec), GFP_KERNEL);
iov = kcalloc(iovnum, sizeof(struct kvec), GFP_KERNEL);
if (!iov) {
usbip_event_add(&sdev->ud, SDEV_EVENT_ERROR_MALLOC);