summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2022-12-19 20:56:36 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-09 11:28:20 +0100
commitd386bc5bf1cd00aee94bfc7b72d20b57d26ff5a8 (patch)
tree529b93fd62af2a2eebe18c3094ecbd846a81a9d6 /arch
parent96d3b446680e28587d4bf7955dc58ae5c525a2f9 (diff)
downloadlinux-riscv-d386bc5bf1cd00aee94bfc7b72d20b57d26ff5a8.tar.gz
linux-riscv-d386bc5bf1cd00aee94bfc7b72d20b57d26ff5a8.tar.bz2
linux-riscv-d386bc5bf1cd00aee94bfc7b72d20b57d26ff5a8.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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index a115315d88e6..bd325f2b5349 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -1303,7 +1303,7 @@ static char iodc_dbuf[4096] __page_aligned_bss;
*/
int pdc_iodc_print(const unsigned char *str, unsigned count)
{
- unsigned int i;
+ unsigned int i, found = 0;
unsigned long flags;
count = min_t(unsigned int, count, sizeof(iodc_dbuf));
@@ -1315,6 +1315,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];
@@ -1330,7 +1331,7 @@ print:
__pa(pdc_result), 0, __pa(iodc_dbuf), i, 0);
spin_unlock_irqrestore(&pdc_lock, flags);
- return i;
+ return i - found;
}
#if !defined(BOOTLOADER)