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, 10 Dec 2009 07:20:54 -0800
From:	Greg KH <gregkh@...e.de>
To:	Wu Zhangjin <wuzhangjin@...il.com>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Potential NULL pointer reference in platform_device_register()

On Thu, Dec 10, 2009 at 04:20:02PM +0800, Wu Zhangjin wrote:
> Hi, Greg KH,
> 
> Should we filter the potential NULL pointer in
> platform_device_register() like this?
> 
> drivers/base/platform.c:
> 
> int platform_device_register(struct platform_device *pdev)
> {
> +	 if (!pdev)
> +                return -EINVAL;

Why, who is calling this function with a NULL pointer?

> 
>         device_initialize(&pdev->dev);
>         return platform_device_add(pdev);
> }
> EXPORT_SYMBOL_GPL(platform_device_register);
> 
> Of course, the developers need to ensure they not register a NULL
> platform device, but sometimes they will not know that.

Why would you never know that?

> Perhaps the above method will hide the real bug, so, what about BUG_ON(!
> pdev).

That is what happens today anyway if you pass a NULL pointer in :)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ