From: redacherkaoui <redacherkaoui67@gmail.com>
To: x86@kernel.org
Cc: tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, hpa@zytor.com,
linux-kernel@vger.kernel.org
Subject: [PATCH] x86/boot/compressed: Fix signedness of rdfs8()
Date: Wed, 18 Feb 2026 15:00:08 +0000 [thread overview]
Message-ID: <20260218150008.28179-1-redacherkaoui67@gmail.com> (raw)
rdfs8() reads a raw byte from the decompressor command line buffer but
returns it as 'char'. On toolchains where 'char' is signed, values in
the range 0x80..0xff become negative when promoted, which can lead to
incorrect comparisons while parsing.
Return u8 from rdfs8() to preserve the correct byte value.
Signed-off-by: redacherkaoui <redacherkaoui67@gmail.com>
---
arch/x86/boot/compressed/cmdline.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c
index e162d7f59cc5..d48ba959dbc5 100644
--- a/arch/x86/boot/compressed/cmdline.c
+++ b/arch/x86/boot/compressed/cmdline.c
@@ -8,13 +8,16 @@ static inline void set_fs(unsigned long seg)
{
fs = seg << 4; /* shift it back */
}
+
typedef unsigned long addr_t;
-static inline char rdfs8(addr_t addr)
+static inline u8 rdfs8(addr_t addr)
{
- return *((char *)(fs + addr));
+ return *(u8 *)(fs + addr);
}
+
#include "../cmdline.c"
-unsigned long get_cmd_line_ptr(void)
+
+static unsigned long get_cmd_line_ptr(void)
{
unsigned long cmd_line_ptr = boot_params_ptr->hdr.cmd_line_ptr;
@@ -22,10 +25,12 @@ unsigned long get_cmd_line_ptr(void)
return cmd_line_ptr;
}
+
int cmdline_find_option(const char *option, char *buffer, int bufsize)
{
return __cmdline_find_option(get_cmd_line_ptr(), option, buffer, bufsize);
}
+
int cmdline_find_option_bool(const char *option)
{
return __cmdline_find_option_bool(get_cmd_line_ptr(), option);
--
2.43.0
next reply other threads:[~2026-02-18 15:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 15:00 redacherkaoui [this message]
2026-02-18 21:26 ` [PATCH] x86/boot/compressed: Fix signedness of rdfs8() kernel test robot
2026-02-18 22:34 ` kernel test robot
2026-02-18 23:13 ` kernel test robot
2026-02-18 23:34 ` H. Peter Anvin
2026-02-19 0:02 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260218150008.28179-1-redacherkaoui67@gmail.com \
--to=redacherkaoui67@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox