From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Jon Loeliger <jdl-CYoMK+44s/E@public.gmane.org>
Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH] Implement and use an xstrdup() function
Date: Sat, 4 Oct 2008 12:41:42 +1000 [thread overview]
Message-ID: <20081004024142.GC30184@yookeroo.seuss> (raw)
In-Reply-To: <1223054108-22342-1-git-send-email-jdl-CYoMK+44s/E@public.gmane.org>
On Fri, Oct 03, 2008 at 12:15:08PM -0500, Jon Loeliger wrote:
> Many places in dtc use strdup(), but none of them actually check the
> return value to see if the implied allocation succeeded. This is a
> potential bug, which we fix in the patch below by replacing strdup()
> with an xstrdup() which in analogy to xmalloc() will quit with a fatal
> error if the allocation fails.
>
> I felt the introduciton of util.[ch] was a better choice
> for utility oriented code than directly using srcpos.c
> for the new string function.
Fair enough. Now that we have a util.c, we should move die() and
xmalloc() in there as well which are currently duplicated between dtc
and convert-dtsv0.
> This patch is a re-factoring of Dave Gibson's similar patch.
>
> Signed-off-by: Jon Loeliger <jdl-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Acked-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2008-10-04 2:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-03 17:15 [PATCH] Implement and use an xstrdup() function Jon Loeliger
[not found] ` <1223054108-22342-1-git-send-email-jdl-CYoMK+44s/E@public.gmane.org>
2008-10-04 2:41 ` David Gibson [this message]
[not found] ` <20081004024142.GC30184-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-10-07 23:54 ` Jon Loeliger
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=20081004024142.GC30184@yookeroo.seuss \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
--cc=jdl-CYoMK+44s/E@public.gmane.org \
/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