From: Daniel Vetter <daniel@ffwll.ch>
To: Mathias Krause <minipli@googlemail.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>,
Brad Spengler <spender@grsecurity.net>,
PaX Team <pageexec@freemail.hu>,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org,
Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH 1/3] dma-buf: propagate errors from dma_buf_describe() on debugfs read
Date: Mon, 20 Jun 2016 15:30:18 +0200 [thread overview]
Message-ID: <20160620133018.GJ23520@phenom.ffwll.local> (raw)
In-Reply-To: <1466339491-12639-2-git-send-email-minipli@googlemail.com>
On Sun, Jun 19, 2016 at 02:31:29PM +0200, Mathias Krause wrote:
> The callback function dma_buf_describe() returns an int not void so the
> function pointer cast in dma_buf_show() is wrong. dma_buf_describe() can
> also fail when acquiring the mutex gets interrupted so always returning
> 0 in dma_buf_show() is wrong, too.
>
> Fix both issues by avoiding the indirection via dma_buf_show() and call
> dma_buf_describe() directly. Rename it to dma_buf_debug_show() to get it
> in line with the other functions.
>
> This type mismatch was caught by the PaX RAP plugin.
>
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Brad Spengler <spender@grsecurity.net>
> Cc: PaX Team <pageexec@freemail.hu>
> ---
> drivers/dma-buf/dma-buf.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 6355ab38d630..7094b19bb495 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -824,7 +824,7 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
> EXPORT_SYMBOL_GPL(dma_buf_vunmap);
>
> #ifdef CONFIG_DEBUG_FS
> -static int dma_buf_describe(struct seq_file *s)
> +static int dma_buf_debug_show(struct seq_file *s, void *unused)
> {
> int ret;
> struct dma_buf *buf_obj;
> @@ -879,17 +879,9 @@ static int dma_buf_describe(struct seq_file *s)
> return 0;
> }
>
> -static int dma_buf_show(struct seq_file *s, void *unused)
> -{
> - void (*func)(struct seq_file *) = s->private;
> -
> - func(s);
> - return 0;
> -}
> -
> static int dma_buf_debug_open(struct inode *inode, struct file *file)
> {
> - return single_open(file, dma_buf_show, inode->i_private);
> + return single_open(file, dma_buf_debug_show, NULL);
> }
>
> static const struct file_operations dma_buf_debug_fops = {
> @@ -913,7 +905,7 @@ static int dma_buf_init_debugfs(void)
> return err;
> }
>
> - err = dma_buf_debugfs_create_file("bufinfo", dma_buf_describe);
> + err = dma_buf_debugfs_create_file("bufinfo", NULL);
This indirection now doesn't make much sense I think. I think more
sensible to instead pass drm_buf_debug_show, since that's the
parametrization that matters. Or just inline that one too.
-Daniel
>
> if (err)
> pr_debug("dma_buf: debugfs: failed to create node bufinfo\n");
> --
> 1.7.10.4
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2016-06-20 13:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-19 12:31 [PATCH 0/3] dma-buf: debugfs fixes Mathias Krause
2016-06-19 12:31 ` [PATCH 1/3] dma-buf: propagate errors from dma_buf_describe() on debugfs read Mathias Krause
2016-06-20 13:30 ` Daniel Vetter [this message]
2016-06-19 12:31 ` [PATCH 2/3] dma-buf: remove dma_buf directory on bufinfo file creation errors Mathias Krause
2016-06-19 12:31 ` [PATCH 3/3] dma-buf: remove dma_buf_debugfs_create_file() Mathias Krause
2016-06-20 13:31 ` Daniel Vetter
2016-06-20 16:32 ` Mathias Krause
2016-06-21 2:17 ` [PATCH 0/3] dma-buf: debugfs fixes Sumit Semwal
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=20160620133018.GJ23520@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=minipli@googlemail.com \
--cc=pageexec@freemail.hu \
--cc=spender@grsecurity.net \
--cc=sumit.semwal@linaro.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