linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug 219951] New: Missing null check in ast_vhub_init_dev
@ 2025-03-28 11:15 bugzilla-daemon
  2025-03-28 11:27 ` Greg KH
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: bugzilla-daemon @ 2025-03-28 11:15 UTC (permalink / raw)
  To: linux-usb

https://bugzilla.kernel.org/show_bug.cgi?id=219951

            Bug ID: 219951
           Summary: Missing null check in ast_vhub_init_dev
           Product: Drivers
           Version: 2.5
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: USB
          Assignee: drivers_usb@kernel-bugs.kernel.org
          Reporter: bsdhenrymartin@gmail.com
        Regression: No

usb: gadget: udc: aspeed-vhub: dev.c
Add NULL check in the ast_vhub_init_dev

When devm_kasprintf() fails, it returns a NULL pointer. However, this return
value is not properly checked in the function ast_vhub_init_dev. 

A NULL check should be added after the devm_kasprintf call to prevent potential
NULL pointer dereference error.

CODE:
        struct ast_vhub_dev *d = &vhub->ports[idx].dev;
        struct device *parent = &vhub->pdev->dev;
        int rc;

        d->vhub = vhub;
        d->index = idx;
        d->name = devm_kasprintf(parent, GFP_KERNEL, "port%d", idx+1);
        d->regs = vhub->regs + 0x100 + 0x10 * idx;

        ast_vhub_init_ep0(vhub, &d->ep0, d);

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-03-29  0:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28 11:15 [Bug 219951] New: Missing null check in ast_vhub_init_dev bugzilla-daemon
2025-03-28 11:27 ` Greg KH
2025-03-28 11:27 ` [Bug 219951] " bugzilla-daemon
2025-03-28 12:41 ` bugzilla-daemon
2025-03-28 13:14 ` bugzilla-daemon
2025-03-28 21:06   ` Greg KH
2025-03-28 21:08 ` bugzilla-daemon
2025-03-29  0:32 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).