From: qiang.zhang@linux.dev
To: "Simon Horman" <horms@kernel.org>
Cc: oneukum@suse.com, kuba@kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: usb: Make init_satus() return -ENOMEM if alloc failed
Date: Thu, 17 Jul 2025 00:04:56 +0000 [thread overview]
Message-ID: <62666ecc6ac9c5217cf5e376424e512a511791fe@linux.dev> (raw)
In-Reply-To: <20250716091839.GM721198@horms.kernel.org>
>
> On Wed, Jul 16, 2025 at 08:15:23AM +0800, Zqiang wrote:
>
> >
> > This commit make init_status() return -ENOMEM, if invoke
> >
> > kmalloc() return failed.
> >
> >
> >
> > Signed-off-by: Zqiang <qiang.zhang@linux.dev>
> >
>
> Hi,
>
> It seems to me that the code has been structured so that
>
> this case is not treated as an error, and rather initialisation
>
> that depends on it is skipped.
Yes, your point is also correct, but in theory,
if usb_alloc_urb() allocation fails, we should
also return a value of 0, should we keep the
two behaviors consistent?
>
> Are you sure this change is correct?
For drivers that have a driver_info->status method, it is generally
needto allocate an interrupt urb and fill it to obtain some
status information, but if kmalloc() faild and return 0 in init_status(),
and some dirvers directly call usbnet_status_start(),
the WARN_ONCE(dev->interrupt == NULL) will be trigger.
Thanks
Zqiang
>
prev parent reply other threads:[~2025-07-17 0:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 0:15 [PATCH] net: usb: Make init_satus() return -ENOMEM if alloc failed Zqiang
2025-07-16 0:15 ` [PATCH] net: usb: Remove duplicate assignments for net->pcpu_stat_type Zqiang
2025-07-16 9:19 ` Simon Horman
2025-07-16 22:11 ` Jakub Kicinski
2025-07-17 0:08 ` qiang.zhang
2025-07-21 9:50 ` patchwork-bot+netdevbpf
2025-07-16 9:18 ` [PATCH] net: usb: Make init_satus() return -ENOMEM if alloc failed Simon Horman
2025-07-17 0:04 ` qiang.zhang [this message]
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=62666ecc6ac9c5217cf5e376424e512a511791fe@linux.dev \
--to=qiang.zhang@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=pabeni@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).