parisc: Fix return code of pdc_iodc_print()
commit 5d1335dabb3c493a3d6d5b233953b6ac7b6c1ff2 upstream. There is an off-by-one if the printed string includes a new-line char. Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7f5df45fcb
commit
8e6cc45ba8
@ -1229,7 +1229,7 @@ static char __attribute__((aligned(64))) iodc_dbuf[4096];
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
|
|
||||||
for (i = 0; i < count;) {
|
for (i = 0; i < count;) {
|
||||||
@ -1238,6 +1238,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];
|
||||||
@ -1254,7 +1255,7 @@ print:
|
|||||||
__pa(iodc_retbuf), 0, __pa(iodc_dbuf), i, 0);
|
__pa(iodc_retbuf), 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user