From: bugzilla-daemon@kernel.org
To: linux-usb@vger.kernel.org
Subject: [Bug 219951] New: Missing null check in ast_vhub_init_dev
Date: Fri, 28 Mar 2025 11:15:22 +0000 [thread overview]
Message-ID: <bug-219951-208809@https.bugzilla.kernel.org/> (raw)
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.
next reply other threads:[~2025-03-28 11:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 11:15 bugzilla-daemon [this message]
2025-03-28 11:27 ` [Bug 219951] New: Missing null check in ast_vhub_init_dev 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-219951-208809@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox