]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
kdb: Use format-strings rather than '\0' injection in kdb_read()
authorDaniel Thompson <daniel.thompson@linaro.org>
Wed, 24 Apr 2024 14:03:35 +0000 (15:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:41:39 +0000 (13:41 +0200)
commitb4e6a259f8d182ae106eb78317aff132e32bc445
tree4f1e1fd5214c49dc4405abc6195ead077b47211a
parent33d9c814652b971461d1e30bead6792851c209e7
kdb: Use format-strings rather than '\0' injection in kdb_read()

commit 09b35989421dfd5573f0b4683c7700a7483c71f9 upstream.

Currently when kdb_read() needs to reposition the cursor it uses copy and
paste code that works by injecting an '\0' at the cursor position before
delivering a carriage-return and reprinting the line (which stops at the
'\0').

Tidy up the code by hoisting the copy and paste code into an appropriately
named function. Additionally let's replace the '\0' injection with a
proper field width parameter so that the string will be abridged during
formatting instead.

Cc: stable@vger.kernel.org # Not a bug fix but it is needed for later bug fixes
Tested-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20240424-kgdb_read_refactor-v3-2-f236dbe9828d@linaro.org
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/debug/kdb/kdb_io.c