From: Christoph Hellwig <hch@lst.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>, Ian Abbott <abbotti@mev.co.uk>,
Jiri Slaby <jslaby@suse.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux-foundation.org,
"kernel-janitors@vger.kernel.org H Hartley Sweeten"
<hsweeten@visionengravers.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-mapping: remove an unnecessary NULL check
Date: Wed, 24 Apr 2019 16:27:43 +0200 [thread overview]
Message-ID: <20190424142743.GC20974@lst.de> (raw)
In-Reply-To: <20190424142437.GA29490@mwanda>
On Wed, Apr 24, 2019 at 05:24:37PM +0300, Dan Carpenter wrote:
> We already dereferenced "dev" when we called get_dma_ops() so this NULL
> check is too late. We're not supposed to pass NULL "dev" pointers to
> dma_alloc_attrs().
Thanks, applied to the dma-mapping for-next tree.
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> There are still at least two drivers which do pass a NULL unfortunately.
>
> drivers/staging/comedi/drivers/comedi_isadma.c:195 comedi_isadma_alloc() error: NULL dereference inside function 'dma_alloc_coherent()'
> drivers/staging/comedi/drivers/comedi_isadma.c:227 comedi_isadma_free() error: NULL dereference inside function 'dma_free_coherent()'
This is staging code. Per official decree from Linus we can just
ignore it, and I tend to do so to keep my sanity.
> drivers/tty/synclink.c:3667 mgsl_alloc_buffer_list_memory() error: NULL dereference inside function 'dma_alloc_coherent()'
> drivers/tty/synclink.c:3738 mgsl_free_buffer_list_memory() error: NULL dereference inside function 'dma_free_coherent()'
> drivers/tty/synclink.c:3777 mgsl_alloc_frame_memory() error: NULL dereference inside function 'dma_alloc_coherent()'
> drivers/tty/synclink.c:3811 mgsl_free_frame_memory() error: NULL dereference inside function 'dma_free_coherent()'
The !PCI case there is dead since I removed PCI support a while ago.
Looks like it is still too convoluted for static checkers to notice that,
though.
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
"kernel-janitors@vger.kernel.org H Hartley Sweeten"
<hsweeten@visionengravers.com>, Ian Abbott <abbotti@mev.co.uk>,
Jiri Slaby <jslaby@suse.com>, Robin Murphy <robin.murphy@arm.com>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] dma-mapping: remove an unnecessary NULL check
Date: Wed, 24 Apr 2019 16:27:43 +0200 [thread overview]
Message-ID: <20190424142743.GC20974@lst.de> (raw)
Message-ID: <20190424142743.frqwdcu4dGOGzkPT4L1E5H16lJpzczOU9S0lDkDdlg8@z> (raw)
In-Reply-To: <20190424142437.GA29490@mwanda>
On Wed, Apr 24, 2019 at 05:24:37PM +0300, Dan Carpenter wrote:
> We already dereferenced "dev" when we called get_dma_ops() so this NULL
> check is too late. We're not supposed to pass NULL "dev" pointers to
> dma_alloc_attrs().
Thanks, applied to the dma-mapping for-next tree.
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> There are still at least two drivers which do pass a NULL unfortunately.
>
> drivers/staging/comedi/drivers/comedi_isadma.c:195 comedi_isadma_alloc() error: NULL dereference inside function 'dma_alloc_coherent()'
> drivers/staging/comedi/drivers/comedi_isadma.c:227 comedi_isadma_free() error: NULL dereference inside function 'dma_free_coherent()'
This is staging code. Per official decree from Linus we can just
ignore it, and I tend to do so to keep my sanity.
> drivers/tty/synclink.c:3667 mgsl_alloc_buffer_list_memory() error: NULL dereference inside function 'dma_alloc_coherent()'
> drivers/tty/synclink.c:3738 mgsl_free_buffer_list_memory() error: NULL dereference inside function 'dma_free_coherent()'
> drivers/tty/synclink.c:3777 mgsl_alloc_frame_memory() error: NULL dereference inside function 'dma_alloc_coherent()'
> drivers/tty/synclink.c:3811 mgsl_free_frame_memory() error: NULL dereference inside function 'dma_free_coherent()'
The !PCI case there is dead since I removed PCI support a while ago.
Looks like it is still too convoluted for static checkers to notice that,
though.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2019-04-24 14:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 14:24 [PATCH] dma-mapping: remove an unnecessary NULL check Dan Carpenter
2019-04-24 14:24 ` Dan Carpenter
2019-04-24 14:24 ` Dan Carpenter
2019-04-24 14:27 ` Christoph Hellwig [this message]
2019-04-24 14:27 ` Christoph Hellwig
2019-04-25 14:13 ` Ian Abbott
2019-04-25 14:13 ` Ian Abbott
2019-04-25 14:18 ` Christoph Hellwig
2019-04-25 14:18 ` Christoph Hellwig
2019-04-25 14:31 ` Ian Abbott
2019-04-25 14:31 ` Ian Abbott
2019-04-25 14:32 ` Christoph Hellwig
2019-04-25 14:32 ` Christoph Hellwig
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=20190424142743.GC20974@lst.de \
--to=hch@lst.de \
--cc=abbotti@mev.co.uk \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.