[RFC 1/3] nvme: Return -ENOMEM when kzalloc fails

Joel Granados j.granados at samsung.com
Mon Oct 31 05:36:01 PDT 2022


On Sun, Oct 30, 2022 at 09:02:36AM +0100, Christoph Hellwig wrote:
> On Thu, Oct 27, 2022 at 10:26:57AM -0600, Keith Busch wrote:
> > On Thu, Oct 27, 2022 at 05:57:22PM +0200, Joel Granados wrote:
> > > In nvme_init_non_mdts_limits function we were returning 0 when kzalloc
> > > failed. This patch corrects this behavior and return -ENOMEM
> > > Fixes: 5befc7c26e5a ("nvme: implement non-mdts command limits")
> > 
> > I'm pretty sure I had this returning 0 on purpose. We can proceed
> > without this optional structure.
> 
> Well, we could.  But I don't think it really is a good idea.  Why I think
> failing major resource allocation (e.g. HMB) and just continuing limited,
> doing that for these tiny kmallocs that the kernel basically never fails
> tends to create a lot of confusion and hard to test code pathes.

This seems like a more sound solution to me. Might just take this out to
a separate thread as a new nvme_identify_cs_ctrl function might not be
needed.

Best
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20221031/d922a1d2/attachment-0001.sig>


More information about the Linux-nvme mailing list