Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1324760

Re: [PATCH] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Alexandre Courbot <gnurou@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] davinci:Fix possible NULL pointer deference in the function davinci_gpio_probe
Date Wed, 03 Feb 2016 01:30:03 +0100
Message-ID <qXTuz-2P5-29@gated-at.bofh.it> (permalink)
References <qXTuz-2P5-31@gated-at.bofh.it>
X-Original-To Nicholas Krause <xerofoify@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=tPlUrN5/E3/nmi1bMBmtQ7PscI54mIQWqCjftvRNELs=; b=XxjA2+UNT0Kc/AQnSOFXbvZ+ytd0WJTSpwcjspPaA0MHdokY1oMxoiHw26bDUNZ3AA mSDhS8wwtQm0cKBE/y2Cz5r2k0WnaRKkdwp/b/arqYeswaC1IYD720IaWY6CSw5VeAa5 W7fIvdZoJHPCqE9aQNsb+eJ1hUROSaXIE92g3mvwhKjeoIJ1cCveyv2D6FmQeeHO1kON dQXu2n5sstH1UeN1sz9f4PjB84bSJan3YplBf/Z+m/RxvhpzsGU37KpsvSk9RsrfKwTb pXc32XfVP5AgFrKJz3n+HeBoxJ6XoZ4ZiL/HCaxIV3Q5urnanspXO6+YYQDlifcBpI0w u2xQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=tPlUrN5/E3/nmi1bMBmtQ7PscI54mIQWqCjftvRNELs=; b=NIxCMxMltsJZPrSLE+RFlBu4pF1NvmNH2/iqNVNRgx6ouIS0Y0WgUV9d+k5y5OkhKw TlPrjxk8GYriBFpFQ4C8xcSOsFSkJlyv2gko1a1PL5ISmM+AWk0xI9X/WWcaxkm28p3x yS3QXmEK/DzkyWlFantqzNkzGxWV7wnT2bjL3bkOsiqzt/q9HthoIz48682V2bE93sqL MPe+ZQlJvhoZRNnCP1EKok72BzDL6w+3/b0M6SDw61iAxB9rR2N+ivSlOTb8xIMmpZVG 4KWAkLzlpLiVSkWCA1Qky5TBPPhuaZvIj+trGVc/UBe2IhVBe0CoAvtDfqjRUuFMgb4T 61Ug==
X-Gm-Message-State AG10YOQDpqjP5kdkjNsmE5nYvDypwU4jI94/LbPWwr+ioEaL5xrarYJ+fcTrDxZANHvqL84WcC2fxKfJQ6FYyQ==
X-Received by 10.50.143.10 with SMTP id sa10mr7558828igb.54.1454459347455; Tue, 02 Feb 2016 16:29:07 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 27
Organization linux.* mail to news gateway
X-Original-Cc Linus Walleij <linus.walleij@linaro.org>, "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
X-Original-Date Wed, 3 Feb 2016 09:28:48 +0900
X-Original-Message-ID <CAAVeFuKS-68h-GVP7hkyoPWo3oavTGJ40=b8w8FxD+7Pwh_rLw@mail.gmail.com>
X-Original-References <1454458679-11165-1-git-send-email-xerofoify@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1324760

Show key headers only | View raw


On Wed, Feb 3, 2016 at 9:17 AM, Nicholas Krause <xerofoify@gmail.com> wrote:
> This fixes a possible NULL pointer deference in the function,
> davinci_gpio_probe due to the function, gpio2regs being able
> to return a NULL pointer if it rans to get the registers for
> the gpio devices on a davinci board. Furthermore if this does
> arise return -ENXIO to signal callers that this case has arisen
> and avoiding setting the regs or other pointer values on the
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/gpio/gpio-davinci.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index ec58f42..1cc527d 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -257,6 +257,8 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>                 spin_lock_init(&chips[i].lock);
>
>                 regs = gpio2regs(base);
> +               if (!regs)
> +                       return -ENXIO;

Ok, a bit futile maybe but this *may* happen in theory...

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] davinci:Fix possible NULL pointer deference in the  function davinci_gpio_probe Alexandre Courbot <gnurou@gmail.com> - 2016-02-03 01:30 +0100

csiph-web