[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdVGhd3KfRq9F+-Qzc7q5kJyczG1RRQDpgs4FqJpPwK4QA@mail.gmail.com>
Date: Sat, 8 Jun 2019 14:26:08 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Rolf Evers-Fischer <embedded24@...rs-fischer.de>
Cc: Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>,
Linux-sh list <linux-sh@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sh: dma: Add missing IS_ERR test
Hi Rolf,
Thanks for your patch!
On Fri, Jun 7, 2019 at 2:04 PM Rolf Evers-Fischer
<embedded24@...rs-fischer.de> wrote:
> get_dma_channel may return ERR_PTR, so a check is added.
It may also return NULL...
> --- a/arch/sh/drivers/dma/dma-api.c
> +++ b/arch/sh/drivers/dma/dma-api.c
> @@ -94,7 +94,7 @@ int get_dma_residue(unsigned int chan)
> struct dma_info *info = get_dma_info(chan);
> struct dma_channel *channel = get_dma_channel(chan);
>
> - if (info->ops->get_residue)
> + if (!IS_ERR(channel) && (info->ops->get_residue))
> return info->ops->get_residue(channel);
... in which case .get_residue() may crash, as some implementations
dereference the passed channel pointer.
Hence !IS_ERR_OR_NULL()?
I didn't check the other callers.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists