[PATCH 1/3] Kernel DLPAR infrastructure

Paul Mackerras paulus at samba.org
Wed Nov 25 14:16:59 EST 2009


Nathan Fontenot writes:

> This patch provides the kernel DLPAR infrastructure in a new filed named
> dlpar.c.  The functionality provided is for acquiring and releasing a resource
> from firmware and the parsing of information returned from the
> ibm,configure-connector rtas call.  Additionally this exports the pSeries
> reconfiguration notifier chain so that it can be invoked when device tree 
> updates are made.

Mostly looks great.

> +static struct device_node *derive_parent(const char *path)
> +{
> +	struct device_node *parent;
> +	char parent_path[128];
> +	int parent_path_len;
> +
> +	parent_path_len = strrchr(path, '/') - path + 1;
> +	strlcpy(parent_path, path, parent_path_len);

This looks a bit fragile if path could possibly not contain any '/' or
if the '/' is more than 128 characters from the start of path.  Please
fix this to check if strrchr returns NULL and to cope in some
reasonable fashion if the path happens to be very long.

> +#ifdef CONFIG_PROC_DEVICETREE
> +	ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
> +	if (ent)
> +		proc_device_tree_add_node(dn, ent);

Also assumes that dn->full_name contains a '/'.  If for some reason it
couldn't possibly not contain a '/', put in a comment explaining that.

Thanks,
Paul.


More information about the Linuxppc-dev mailing list