diff options
| author | Helge Deller <deller@gmx.de> | 2022-12-19 20:56:36 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-15 17:22:19 +0100 |
| commit | 2982b473d764b4d02a40c84246a2d576d411427d (patch) | |
| tree | 9d0c0bdbdf15410cc9c4b74c03781197633b9d48 /arch | |
| parent | 170e1cc3c00fae434c40edd5535d2665c7afeb11 (diff) | |
| download | linux-2982b473d764b4d02a40c84246a2d576d411427d.tar.gz linux-2982b473d764b4d02a40c84246a2d576d411427d.tar.bz2 linux-2982b473d764b4d02a40c84246a2d576d411427d.zip | |
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>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/parisc/kernel/firmware.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c index 665b70086685..7ed28ddcaba7 100644 --- a/arch/parisc/kernel/firmware.c +++ b/arch/parisc/kernel/firmware.c @@ -1230,7 +1230,7 @@ static char __attribute__((aligned(64))) iodc_dbuf[4096]; */ int pdc_iodc_print(const unsigned char *str, unsigned count) { - unsigned int i; + unsigned int i, found = 0; unsigned long flags; for (i = 0; i < count;) { @@ -1239,6 +1239,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) iodc_dbuf[i+0] = '\r'; iodc_dbuf[i+1] = '\n'; i += 2; + found = 1; goto print; default: iodc_dbuf[i] = str[i]; @@ -1255,7 +1256,7 @@ print: __pa(iodc_retbuf), 0, __pa(iodc_dbuf), i, 0); spin_unlock_irqrestore(&pdc_lock, flags); - return i; + return i - found; } #if !defined(BOOTLOADER) |
