Skip to content

Commit 5d1335d

Browse files
committed
parisc: Fix return code of pdc_iodc_print()
There is an off-by-one if the printed string includes a new-line char. Cc: [email protected] Signed-off-by: Helge Deller <[email protected]>
1 parent f2193bb commit 5d1335d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/parisc/kernel/firmware.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ static char iodc_dbuf[4096] __page_aligned_bss;
13031303
*/
13041304
int pdc_iodc_print(const unsigned char *str, unsigned count)
13051305
{
1306-
unsigned int i;
1306+
unsigned int i, found = 0;
13071307
unsigned long flags;
13081308

13091309
count = min_t(unsigned int, count, sizeof(iodc_dbuf));
@@ -1315,6 +1315,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
13151315
iodc_dbuf[i+0] = '\r';
13161316
iodc_dbuf[i+1] = '\n';
13171317
i += 2;
1318+
found = 1;
13181319
goto print;
13191320
default:
13201321
iodc_dbuf[i] = str[i];
@@ -1330,7 +1331,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
13301331
__pa(pdc_result), 0, __pa(iodc_dbuf), i, 0);
13311332
spin_unlock_irqrestore(&pdc_lock, flags);
13321333

1333-
return i;
1334+
return i - found;
13341335
}
13351336

13361337
#if !defined(BOOTLOADER)

0 commit comments

Comments
 (0)