* [PATCH 1/2] platform/x86: use u8 * for raw byte buffers
@ 2026-04-10 9:16 Thorsten Blum
2026-04-10 9:16 ` [PATCH 2/2] platform/x86: dell_rbu: use strscpy in image_type_write Thorsten Blum
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-04-10 9:16 UTC (permalink / raw)
To: Prasanth Ksr, Hans de Goede, Ilpo Järvinen
Cc: Thorsten Blum, Dell.Client.Kernel, platform-driver-x86,
linux-kernel
The buffer parameters in populate_{security,string}_buffer() and
call_{biosattributes,password}_interface() are raw byte buffers, not
character strings - use 'u8 *' instead of 'char *' to reflect this.
Update the local buffer variables at the call sites and in
populate_security_buffer() accordingly.
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
.../x86/dell/dell-wmi-sysman/biosattr-interface.c | 8 ++++----
.../platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h | 4 ++--
.../x86/dell/dell-wmi-sysman/passwordattr-interface.c | 4 ++--
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 6 +++---
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c b/drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c
index c2dd2de6bc20..db278ff4cc4d 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/biosattr-interface.c
@@ -13,8 +13,8 @@
#define SETBIOSDEFAULTS_METHOD_ID 0x03
#define SETATTRIBUTE_METHOD_ID 0x04
-static int call_biosattributes_interface(struct wmi_device *wdev, char *in_args, size_t size,
- int method_id)
+static int call_biosattributes_interface(struct wmi_device *wdev, u8 *in_args,
+ size_t size, int method_id)
{
struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
struct acpi_buffer input;
@@ -51,7 +51,7 @@ int set_attribute(const char *a_name, const char *a_value)
{
size_t security_area_size, buffer_size;
size_t a_name_size, a_value_size;
- char *buffer = NULL, *start;
+ u8 *buffer = NULL, *start;
int ret;
mutex_lock(&wmi_priv.mutex);
@@ -109,7 +109,7 @@ int set_bios_defaults(u8 deftype)
{
size_t security_area_size, buffer_size;
size_t integer_area_size = sizeof(u8);
- char *buffer = NULL;
+ u8 *buffer = NULL;
u8 *defaultType;
int ret;
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h b/drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h
index 5278a93fdaf7..3bddedad5eba 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h
@@ -190,8 +190,8 @@ int init_bios_attr_set_interface(void);
int map_wmi_error(int error_code);
size_t calculate_string_buffer(const char *str);
size_t calculate_security_buffer(const char *authentication);
-void populate_security_buffer(char *buffer, const char *authentication);
-ssize_t populate_string_buffer(char *buffer, size_t buffer_len, const char *str);
+void populate_security_buffer(u8 *buffer, const char *authentication);
+ssize_t populate_string_buffer(u8 *buffer, size_t buffer_len, const char *str);
int set_new_password(const char *password_type, const char *new);
int init_bios_attr_pass_interface(void);
void exit_bios_attr_pass_interface(void);
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c b/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c
index e586f7957946..026c134b3f97 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/passwordattr-interface.c
@@ -8,7 +8,7 @@
#include <linux/wmi.h>
#include "dell-wmi-sysman.h"
-static int call_password_interface(struct wmi_device *wdev, char *in_args, size_t size)
+static int call_password_interface(struct wmi_device *wdev, u8 *in_args, size_t size)
{
struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
struct acpi_buffer input;
@@ -42,7 +42,7 @@ int set_new_password(const char *password_type, const char *new)
{
size_t password_type_size, current_password_size, new_size;
size_t security_area_size, buffer_size;
- char *buffer = NULL, *start;
+ u8 *buffer = NULL, *start;
char *current_password;
int ret;
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
index 51d25fdc1389..ab46a023cc34 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
@@ -36,7 +36,7 @@ static int reset_option = -1;
* @buffer_len: length of the destination buffer
* @str: the string to insert into buffer
*/
-ssize_t populate_string_buffer(char *buffer, size_t buffer_len, const char *str)
+ssize_t populate_string_buffer(u8 *buffer, size_t buffer_len, const char *str)
{
u16 *length = (u16 *)buffer;
u16 *target = length + 1;
@@ -87,10 +87,10 @@ size_t calculate_security_buffer(const char *authentication)
*
* Currently only supported type is PLAIN TEXT
*/
-void populate_security_buffer(char *buffer, const char *authentication)
+void populate_security_buffer(u8 *buffer, const char *authentication)
{
size_t seclen = strlen(authentication);
- char *auth = buffer + sizeof(u32) * 2;
+ u8 *auth = buffer + sizeof(u32) * 2;
u32 *sectype = (u32 *) buffer;
u32 *seclenp = sectype + 1;
base-commit: a29b5cd42f5bc6ba1be6422f61f3f05bab707ce8
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 2/2] platform/x86: dell_rbu: use strscpy in image_type_write
2026-04-10 9:16 [PATCH 1/2] platform/x86: use u8 * for raw byte buffers Thorsten Blum
@ 2026-04-10 9:16 ` Thorsten Blum
0 siblings, 0 replies; 2+ messages in thread
From: Thorsten Blum @ 2026-04-10 9:16 UTC (permalink / raw)
To: Stuart Hayes, Hans de Goede, Ilpo Järvinen
Cc: Thorsten Blum, platform-driver-x86, linux-kernel
strcpy() has been deprecated [1] because it performs no bounds checking
on the destination buffer, which can lead to buffer overflows. While the
current code works correctly, replace strcpy() with the safer strscpy()
to follow secure coding best practices.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/platform/x86/dell/dell_rbu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/dell/dell_rbu.c b/drivers/platform/x86/dell/dell_rbu.c
index 3fa9de9aa47b..768b15f406d3 100644
--- a/drivers/platform/x86/dell/dell_rbu.c
+++ b/drivers/platform/x86/dell/dell_rbu.c
@@ -562,9 +562,9 @@ static ssize_t image_type_write(struct file *filp, struct kobject *kobj,
buffer[count] = '\0';
if (strstr(buffer, "mono"))
- strcpy(image_type, "mono");
+ strscpy(image_type, "mono");
else if (strstr(buffer, "packet"))
- strcpy(image_type, "packet");
+ strscpy(image_type, "packet");
else if (strstr(buffer, "init")) {
/*
* If due to the user error the driver gets in a bad
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-10 9:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 9:16 [PATCH 1/2] platform/x86: use u8 * for raw byte buffers Thorsten Blum
2026-04-10 9:16 ` [PATCH 2/2] platform/x86: dell_rbu: use strscpy in image_type_write Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox