public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel•crashing.org>
To: Andy Shevchenko <andriy.shevchenko@linux•intel.com>
Cc: Benjamin Herrenschmidt <benh@kernel•crashing.org>,
	linuxppc-dev@lists•ozlabs.org,
	Michael Ellerman <mpe@ellerman•id.au>
Subject: Re: [PATCH 1/5] powerpc/pseries: extract of_helpers module
Date: Wed, 5 Aug 2015 00:20:57 -0500	[thread overview]
Message-ID: <20150805052057.GB32178@gate.crashing.org> (raw)
In-Reply-To: <1438699009-112794-1-git-send-email-andriy.shevchenko@linux.intel.com>

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 :-)


Segher

  parent reply	other threads:[~2015-08-05  5:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 14:36 [PATCH 1/5] powerpc/pseries: extract of_helpers module Andy Shevchenko
2015-08-04 14:36 ` [PATCH 2/5] powerpc/pseries: fix a potential memory leak Andy Shevchenko
2015-08-04 14:36 ` [PATCH 3/5] powerpc/pseries: don't call strrchr() twice Andy Shevchenko
2015-08-04 14:36 ` [PATCH 4/5] powerpc/pseries: replace kmalloc + strlcpy Andy Shevchenko
2015-08-04 14:36 ` [PATCH 5/5] powerpc/pseries: re-use code from of_helpers module Andy Shevchenko
2015-08-05  5:20 ` Segher Boessenkool [this message]
2015-08-05  9:32   ` [PATCH 1/5] powerpc/pseries: extract " Andy Shevchenko
2015-08-05 17:20     ` Segher Boessenkool

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150805052057.GB32178@gate.crashing.org \
    --to=segher@kernel$(echo .)crashing.org \
    --cc=andriy.shevchenko@linux$(echo .)intel.com \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mpe@ellerman$(echo .)id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox