[PATCH 1/5] powerpc/pseries: extract of_helpers module

Andy Shevchenko andriy.shevchenko at linux.intel.com
Wed Aug 5 19:32:55 AEST 2015


On Wed, 2015-08-05 at 00:20 -0500, Segher Boessenkool wrote:
> Hi Andy,
> 
> On Tue, Aug 04, 2015 at 05:36:45PM +0300, Andy Shevchenko wrote:
> > +struct device_node *pseries_of_derive_parent(const char *path)
> > +{
> > +	struct device_node *parent = NULL;
> > +	char *parent_path = "/";
> > +	size_t parent_path_len = strrchr(path, '/') - path + 1;
> > +
> > +	/* reject if path is "/" */
> > +	if (!strcmp(path, "/"))
> > +		return ERR_PTR(-EINVAL);
> > +
> > +	if (strrchr(path, '/') != path) {
> > +		parent_path = kmalloc(parent_path_len, 
> > GFP_KERNEL);
> 
> If path doesn't contain any slash this will do interesting things;
> you might want to fix that too while you're at it :-)

No problem, though it is in the original code. I would do as a separate
patch on top of the series. Will be okay for you?

> 
> 
> Segher

-- 
Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Intel Finland Oy


More information about the Linuxppc-dev mailing list