lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 19 Jan 2017 20:48:07 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Arvind Yadav <arvind.yadav.cs@...il.com>
Cc:     jejb@...isc-linux.org, Helge Deller <deller@....de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jslaby@...e.com>, linux-parisc@...r.kernel.org,
        "linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] tty: serial: 8250: 8250_gsc:- Handle return NULL error
 from ioremap_nocache

On Thu, Jan 19, 2017 at 10:00 AM, Arvind Yadav
<arvind.yadav.cs@...il.com> wrote:
> Here, If ioremap_nocache will fail. It will return NULL.
> Kernel can run into a NULL-pointer dereference.
> This error check will avoid NULL pointer dereference.

>         uart.port.mapbase       = address;
>         uart.port.membase       = ioremap_nocache(address, 16);
> +       if (!uart.port.membase) {
> +               dev_warn(&dev->dev, "Failed to map memory\n");
> +               return -ENOMEM;
> +       }

You also may do something like

void __iomem *base;
...

base = ioremap_nocache(...);
if (!base)
 return -ENOMEM;
// I doubt the message is useful, up to you

memset(&uart, 0, sizeof(uart));
...
uart.port.membase       = base;

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ