linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Vladimir Zapolskiy <vz@mleia.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] omapfb: panel-sharp-ls037v7dw01: fix check of gpio_to_desc() return value
Date: Mon, 18 Apr 2016 09:20:28 +0000	[thread overview]
Message-ID: <5714A6DC.2@ti.com> (raw)
In-Reply-To: <1458687114-9390-1-git-send-email-vz@mleia.com>


[-- Attachment #1.1: Type: text/plain, Size: 1488 bytes --]



On 23/03/16 00:51, Vladimir Zapolskiy wrote:
> The change fixes a check of gpio_to_desc() return value, the function
> returns either a valid pointer to struct gpio_desc or NULL, this makes
> IS_ERR() check invalid and may lead to a NULL pointer dereference in
> runtime.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> ---
>  .../fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c    | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c
> index abfd1f6..1954ec9 100644
> --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c
> +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-sharp-ls037v7dw01.c
> @@ -200,20 +200,16 @@ static struct omap_dss_driver sharp_ls_ops = {
>  static int sharp_ls_get_gpio(struct device *dev, int gpio, unsigned long flags,
>  		  char *desc, struct gpio_desc **gpiod)
>  {
> -	struct gpio_desc *gd;
>  	int r;
>  
> -	*gpiod = NULL;
> -
>  	r = devm_gpio_request_one(dev, gpio, flags, desc);
> -	if (r)
> +	if (r) {
> +		*gpiod = NULL;
>  		return r == -ENOENT ? 0 : r;
> +	}
>  
> -	gd = gpio_to_desc(gpio);
> -	if (IS_ERR(gd))
> -		return PTR_ERR(gd) == -ENOENT ? 0 : PTR_ERR(gd);
> +	*gpiod = gpio_to_desc(gpio);
>  
> -	*gpiod = gd;
>  	return 0;
>  }
>  
> 

Thanks, queued for 4.6 fixes.

 Tomi


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2016-04-18  9:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 22:51 [PATCH] omapfb: panel-sharp-ls037v7dw01: fix check of gpio_to_desc() return value Vladimir Zapolskiy
2016-04-18  9:20 ` Tomi Valkeinen [this message]

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=5714A6DC.2@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=plagnioj@jcrosoft.com \
    --cc=vz@mleia.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;
as well as URLs for NNTP newsgroup(s).