Commit 5d1335da authored by Helge Deller's avatar Helge Deller

parisc: Fix return code of pdc_iodc_print()

There is an off-by-one if the printed string includes a new-line
char.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent f2193bb2
...@@ -1303,7 +1303,7 @@ static char iodc_dbuf[4096] __page_aligned_bss; ...@@ -1303,7 +1303,7 @@ static char iodc_dbuf[4096] __page_aligned_bss;
*/ */
int pdc_iodc_print(const unsigned char *str, unsigned count) int pdc_iodc_print(const unsigned char *str, unsigned count)
{ {
unsigned int i; unsigned int i, found = 0;
unsigned long flags; unsigned long flags;
count = min_t(unsigned int, count, sizeof(iodc_dbuf)); count = min_t(unsigned int, count, sizeof(iodc_dbuf));
...@@ -1315,6 +1315,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) ...@@ -1315,6 +1315,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
iodc_dbuf[i+0] = '\r'; iodc_dbuf[i+0] = '\r';
iodc_dbuf[i+1] = '\n'; iodc_dbuf[i+1] = '\n';
i += 2; i += 2;
found = 1;
goto print; goto print;
default: default:
iodc_dbuf[i] = str[i]; iodc_dbuf[i] = str[i];
...@@ -1330,7 +1331,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) ...@@ -1330,7 +1331,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
__pa(pdc_result), 0, __pa(iodc_dbuf), i, 0); __pa(pdc_result), 0, __pa(iodc_dbuf), i, 0);
spin_unlock_irqrestore(&pdc_lock, flags); spin_unlock_irqrestore(&pdc_lock, flags);
return i; return i - found;
} }
#if !defined(BOOTLOADER) #if !defined(BOOTLOADER)
......
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