From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lothar =?UTF-8?B?V2HDn21hbm4=?= Date: Wed, 5 Jul 2017 08:32:20 +0200 Subject: [U-Boot] [PATCH 5/5] fit: Introduce methods for applying overlays on fit-load In-Reply-To: <2067154.9qYUSksqAR@pebbles.site> References: <1498839782-4702-1-git-send-email-pantelis.antoniou@konsulko.com> <79bbc885-fe29-3511-05d1-cc74f9ad3bf9@denx.de> <1499187925.4225.49.camel@hp800z> <2067154.9qYUSksqAR@pebbles.site> Message-ID: <20170705083220.3b0bf35a@karo-electronics.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de Hi, On Wed, 5 Jul 2017 00:19:28 +0200 stefan.bruens at rwth-aachen.de wrote: > On Dienstag, 4. Juli 2017 19:05:25 CEST Pantelis Antoniou wrote: > > Hi Marek, > >=20 > > On Sat, 2017-07-01 at 16:11 +0200, Marek Vasut wrote: > > > On 06/30/2017 06:23 PM, Pantelis Antoniou wrote: > > > > Introduce an overlay based method for constructing a base DT blob > > > > to pass to the kernel. > > > >=20 > > > > Both canned and runtime feature selection is supported. > > > >=20 > > > > Signed-off-by: Pantelis Antoniou > > >=20 > > > [...] > > >=20 > > > > @@ -1475,29 +1482,58 @@ int fit_conf_get_node(const void *fit, const > > > > char *conf_uname)> >=20 > > > > debug("Found default configuration: '%s'\n", conf_uname); > > > > =09 > > > > } > > > >=20 > > > > + s =3D strchr(conf_uname, '#'); > > > > + if (s) { > > > > + len =3D s - conf_uname; > > > > + conf_uname_copy =3D malloc(len + 1); > > > > + if (!conf_uname_copy) { > > > > + debug("Can't allocate uname copy: '%s'\n", > > > > + conf_uname); > > > > + return -ENOMEM; > > > > + } > > > > + memcpy(conf_uname_copy, conf_uname, len); > > >=20 > > > Is that like strdup() here ? > >=20 > > No. The space allocated is not the full string, just the span until the > > next #. >=20 > You could use strndup() to copy only the first n characters. > =20 or strsep() to tokenize (a copy of) the original string. IMO using strdup() and strsep() makes the intent of this function clearer, than the current code.=20 Lothar Wa=C3=9Fmann