Commit bdb61896 authored by Thorsten Blum's avatar Thorsten Blum Committed by Greg Kroah-Hartman
Browse files

most: usb: Use kzalloc_objs for endpoint address array



Replace kcalloc() with kzalloc_objs() when allocating the endpoint
address array to keep the size type-safe and match nearby allocations.
Reformat ->busy_urbs allocation to a single line. No functional change.

Signed-off-by: default avatarThorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: default avatarKees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260225180329.712101-2-thorsten.blum@linux.dev


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 71f0a267
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -1009,13 +1009,11 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
		goto err_free_conf;

	mdev->iface.channel_vector = mdev->cap;
	mdev->ep_address =
		kcalloc(num_endpoints, sizeof(*mdev->ep_address), GFP_KERNEL);
	mdev->ep_address = kzalloc_objs(*mdev->ep_address, num_endpoints);
	if (!mdev->ep_address)
		goto err_free_cap;

	mdev->busy_urbs =
		kzalloc_objs(*mdev->busy_urbs, num_endpoints);
	mdev->busy_urbs = kzalloc_objs(*mdev->busy_urbs, num_endpoints);
	if (!mdev->busy_urbs)
		goto err_free_ep_address;