From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: barebox crashes with CONFIG_CMD_MAGICVAR=y and CONFIG_CMD_MAGICVAR_HELP unset
Date: Thu, 8 Sep 2016 21:27:52 +0200 [thread overview]
Message-ID: <20160908192752.dshheqp2qntzmon6@pengutronix.de> (raw)
Hello,
with
CONFIG_CMD_MAGICVAR=y
# CONFIG_CMD_MAGICVAR_HELP is not set
calling magicvar results in
md->description = xstrdup(description)
in line 64 of commands/magicvar.c. As CONFIG_CMD_MAGICVAR_HELP is not
set, description is NULL which makes xstrdup fail.
I fixed it here doing
- md->description = xstrdup(description);
+ md->description = description ? xstrdup(description) : NULL;
but I can imagine other variants:
if (IS_ENABLED(CONFIG_CMD_MAGICVAR_HELP))
md->description = xstrdup(description);
or fixing xstrdup to not choke on NULL.
What do you prefer?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2016-09-08 19:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 19:27 Uwe Kleine-König [this message]
2016-09-09 6:25 ` Sascha Hauer
2016-09-09 6:37 ` [PATCH] xstrdup: don't panic on xstrdup(NULL) Uwe Kleine-König
2016-09-12 6:16 ` Sascha Hauer
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=20160908192752.dshheqp2qntzmon6@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=barebox@lists.infradead.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