public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] cmd/fdt: support single value replacement within an array
Date: Fri, 18 Aug 2017 11:14:39 +0300	[thread overview]
Message-ID: <3922842.hLOOnAKnR5@avalon> (raw)
In-Reply-To: <OFEA3AF316.C52FC96E-ONC1258180.002B95C0-C1258180.002C9DCD@LocalDomain>

Hi Hannes,

On Friday 18 Aug 2017 10:07:19 Hannes Schmelzer wrote:
> Laurent Pinchart schrieb am 04.08.2017 23:23:19:
> 
> Hi Laurent,
> 
> as told a few days ago i'm now coming back to this issue.

Thank you.

> > (I'm not subscribed to the list, please keep me CC'ed on replies)
> 
> subscribing to the list would be a great idea, so you're always up to date
> whats going on ;-)

I know, but I've already stopped reading mailing lists I'm subscribed to due 
to the amount of traffic, so I figured out that subscribing to new ones 
wouldn't be a good idea :-)

> > On Tuesday 30 May 2017 13:05:00 Hannes Schmelzer wrote:
> >> With this commit we can modify single values within an array of a dts
> >> property.
> > 
> > But with this commit U-Boot crashes if you try to create a new property
> > with the fdt set command :-/
> > 
> > I've tested v2017.07 with the commit reverted, and fdt set works again
> > for me. The issue is that your fdt_getprop() call fails and return NULL
> > with len set to -1. You can easily imagine what the memcpy() following it
> > will do.
> 
> Yes. Your'e right with that.
> 
> I just checked most current source (...), there were changes regarding
> this issue.
> Tom introduced a check against the fail of fdt_getprop(...) call.
> 
> http://git.denx.de/?p=u-boot.git;a=commitdiff;h=99bb38e2cce9d99238458e0f6d18
> 80c6d2e80a4d
> 
> Can you please try with your testcase with most current source again?
> 
> please let us know if the problem is fixed with this.

I can't test that right now as I don't have access to my hardware at the 
moment, but I doubt it will work.

The code now reads as

	ptmp = fdt_getprop(working_fdt, nodeoffset, prop, &len);
	if (!ptmp) {
		printf("prop (%s) not found!\n", prop);
		return 1;
	}

The new !ptmp check should prevent the crash, but it will also prevent the fdt 
set command from operating correctly, as it will return an error if the 
property isn't found.

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2017-08-18  8:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 21:23 [U-Boot] cmd/fdt: support single value replacement within an array Laurent Pinchart
2017-08-16  7:05 ` Hannes Schmelzer
2017-08-18  8:07 ` Hannes Schmelzer
2017-08-18  8:14   ` Laurent Pinchart [this message]
2017-08-18 12:49     ` [U-Boot] Antwort: " Hannes Schmelzer

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=3922842.hLOOnAKnR5@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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