Commit 15433768 authored by Julian Calaby's avatar Julian Calaby Committed by David S. Miller

sparc: prom: Sanitize return value from prom_nbputchar()

Signed-off-by: default avatarJulian Calaby <julian.calaby@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 23bcbf1b
...@@ -27,13 +27,14 @@ static int prom_nbputchar(const char *buf) ...@@ -27,13 +27,14 @@ static int prom_nbputchar(const char *buf)
spin_lock_irqsave(&prom_lock, flags); spin_lock_irqsave(&prom_lock, flags);
switch(prom_vers) { switch(prom_vers) {
case PROM_V0: case PROM_V0:
i = (*(romvec->pv_nbputchar))(*buf); if ((*(romvec->pv_nbputchar))(*buf))
i = 1;
break; break;
case PROM_V2: case PROM_V2:
case PROM_V3: case PROM_V3:
if ((*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, if ((*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout,
buf, 0x1) == 1) buf, 0x1) == 1)
i = 0; i = 1;
break; break;
default: default:
break; break;
...@@ -47,7 +48,7 @@ void prom_console_write_buf(const char *buf, int len) ...@@ -47,7 +48,7 @@ void prom_console_write_buf(const char *buf, int len)
{ {
while (len) { while (len) {
int n = prom_nbputchar(buf); int n = prom_nbputchar(buf);
if (n) if (n < 0)
continue; continue;
len--; len--;
buf++; buf++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment