From: Matthew Wilcox <willy@infradead.org>
To: Tony Battersby <tonyb@cybernetics.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Christoph Hellwig <hch@lst.de>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Sathya Prakash <sathya.prakash@broadcom.com>,
Chaitra P B <chaitra.basappa@broadcom.com>,
Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
iommu@lists.linux-foundation.org, linux-mm <linux-mm@kvack.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
MPT-FusionLinux.pdl@broadcom.com
Subject: Re: [PATCH v2 2/9] dmapool: cleanup error messages
Date: Fri, 3 Aug 2018 14:07:45 -0700 [thread overview]
Message-ID: <20180803210745.GB9329@bombadil.infradead.org> (raw)
In-Reply-To: <f0762902-8f28-82eb-b871-337c2da290cf@cybernetics.com>
On Fri, Aug 03, 2018 at 02:43:07PM -0400, Tony Battersby wrote:
> Out of curiosity, I just tried to create a dmapool with a NULL dev and
> it crashed on this:
>
> static inline int dev_to_node(struct device *dev)
> {
> return dev->numa_node;
> }
>
> struct dma_pool *dma_pool_create(const char *name, struct device *dev,
> size_t size, size_t align, size_t boundary)
> {
> ...
> retval = kmalloc_node(sizeof(*retval), GFP_KERNEL, dev_to_node(dev));
> ...
> }
>
> So either it needs more special cases for supporting a NULL dev, or the
> special cases can be removed since no one does that anyway.
Actually, it's worse. dev_to_node() works with a NULL dev ... unless
CONFIG_NUMA is set. So we're leaving a timebomb by pretending to
allow it. Let's just 'if (!dev) return NULL;' early in create.
next prev parent reply other threads:[~2018-08-03 21:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 19:57 Tony Battersby
2018-08-03 8:56 ` Andy Shevchenko
2018-08-03 13:41 ` Tony Battersby
2018-08-03 15:17 ` Tony Battersby
2018-08-03 15:59 ` Andy Shevchenko
2018-08-03 16:01 ` Andy Shevchenko
2018-08-03 16:10 ` Tony Battersby
2018-08-03 16:22 ` Matthew Wilcox
2018-08-03 17:03 ` Tony Battersby
2018-08-03 18:38 ` Andy Shevchenko
2018-08-03 18:44 ` Tony Battersby
2018-08-03 19:07 ` Douglas Gilbert
2018-08-03 18:43 ` Tony Battersby
2018-08-03 21:07 ` Matthew Wilcox [this message]
2018-08-03 21:18 ` Tony Battersby
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=20180803210745.GB9329@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=andy.shevchenko@gmail.com \
--cc=chaitra.basappa@broadcom.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=linux-scsi@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=sathya.prakash@broadcom.com \
--cc=suganath-prabu.subramani@broadcom.com \
--cc=tonyb@cybernetics.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