[PATCH] PPC: CHRP - fix possible NULL pointer dereference

Stephen Rothwell sfr at canb.auug.org.au
Fri Nov 23 10:16:46 EST 2007


On Thu, 22 Nov 2007 22:54:23 +0300 Cyrill Gorcunov <gorcunov at gmail.com> wrote:
>
> This patch does fix possible NULL pointer dereference
> inside of strncmp() if of_get_property() failed.

Thanks for this.

>  static void __init sio_init(void)
>  {
>  	struct device_node *root;
> +	const char *model = NULL;

You don't need this initialization as you always assign the variable
before you use it.

> +	root = of_find_node_by_path("/");
> +	if (root) {

	if (!root)
		return;

would save a level of indentation. Not important.

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20071123/f9b242f4/attachment.pgp>


More information about the Linuxppc-dev mailing list