From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org
Subject: [PATCH] commands: loady: fix bug with netconsole
Date: Thu, 1 Jan 2015 21:04:21 +0100 [thread overview]
Message-ID: <1420142663-6243-1-git-send-email-robert.jarzmik@free.fr> (raw)
Netconsole doesn't have a baudrate. Loady supposes a console has one,
and tries to compute the console's baudrate variable value, regardless
of its existence.
This triggers a NULL pointer dereference on netconsole. If attempting
loady on a netconsole is a bit useless, barebox should not panic. Fix
this by checking the variable exists before reading its value.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
commands/loadxy.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/commands/loadxy.c b/commands/loadxy.c
index df14043..1e65cb6 100644
--- a/commands/loadxy.c
+++ b/commands/loadxy.c
@@ -43,10 +43,10 @@
static int console_change_speed(struct console_device *cdev, int baudrate)
{
int current_baudrate;
+ const char *bstr;
- current_baudrate =
- (int)simple_strtoul(dev_get_param(&cdev->class_dev,
- "baudrate"), NULL, 10);
+ bstr = dev_get_param(&cdev->class_dev, "baudrate");
+ current_baudrate = bstr ? (int)simple_strtoul(bstr, NULL, 10) : 0;
if (baudrate && baudrate != current_baudrate) {
printf("## Switch baudrate from %d to %d bps and press ENTER ...\n",
current_baudrate, baudrate);
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2015-01-01 20:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-01 20:04 Robert Jarzmik [this message]
2015-01-01 20:04 ` [PATCH] net: smc1111: fix memory congestions Robert Jarzmik
2015-01-05 12:11 ` Sascha Hauer
2015-01-05 16:16 ` robert.jarzmik
2015-01-06 13:58 ` Sascha Hauer
2015-01-01 20:04 ` [PATCH] net: smc1111: move print_packet function Robert Jarzmik
2015-01-05 12:12 ` Sascha Hauer
2015-01-05 12:12 ` [PATCH] commands: loady: fix bug with netconsole 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=1420142663-6243-1-git-send-email-robert.jarzmik@free.fr \
--to=robert.jarzmik@free.fr \
--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