]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
most: usb: Use kzalloc_objs for endpoint address array
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 25 Feb 2026 18:03:29 +0000 (19:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2026 15:06:09 +0000 (17:06 +0200)
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: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260225180329.712101-2-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/most/most_usb.c

index d2c0875727a3d6db072c765c78649ad6b40e2b66..6437733afee0596f3d00ea55914d2d55f9de9a69 100644 (file)
@@ -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;