Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8921>
94 lines
3.5 KiB
Diff
94 lines
3.5 KiB
Diff
diff --git a/beepberry-keyboard-driver/src/params_iface.c b/beepberry-keyboard-driver/src/params_iface.c
|
|
index 1d77ef6..d2fe82c 100644
|
|
--- a/beepberry-keyboard-driver/src/params_iface.c
|
|
+++ b/beepberry-keyboard-driver/src/params_iface.c
|
|
@@ -59,7 +59,7 @@ static int set_touch_act_setting(struct kbd_ctx* ctx, char const* val)
|
|
// Copy provided value to buffer and strip it of newlines
|
|
static char* copy_and_strip(char* buf, size_t buf_len, const char* val)
|
|
{
|
|
- strncpy(buf, val, buf_len - 1);
|
|
+ strscpy(buf, val, buf_len - 1);
|
|
buf[buf_len - 1] = '\0';
|
|
return strstrip(buf);
|
|
}
|
|
@@ -103,7 +103,7 @@ static int touch_shift_setting_param_set(const char *val, const struct kernel_pa
|
|
char stripped_val_buf[2];
|
|
|
|
// Copy provided value to buffer and strip it of newlines
|
|
- strncpy(stripped_val_buf, val, 2);
|
|
+ strscpy(stripped_val_buf, val, 2);
|
|
stripped_val_buf[1] = '\0';
|
|
stripped_val = strstrip(stripped_val_buf);
|
|
|
|
@@ -192,7 +192,7 @@ static int touch_min_squal_param_set(const char *val, const struct kernel_param
|
|
char stripped_val_buf[4];
|
|
|
|
// Copy provided value to buffer and strip it of newlines
|
|
- strncpy(stripped_val_buf, val, 4);
|
|
+ strscpy(stripped_val_buf, val, 4);
|
|
stripped_val_buf[3] = '\0';
|
|
stripped_val = strstrip(stripped_val_buf);
|
|
|
|
@@ -242,7 +242,7 @@ static int touch_threshold_param_set(const char *val, const struct kernel_param
|
|
char stripped_val_buf[4];
|
|
|
|
// Copy provided value to buffer and strip it of newlines
|
|
- strncpy(stripped_val_buf, val, 4);
|
|
+ strscpy(stripped_val_buf, val, 4);
|
|
stripped_val_buf[3] = '\0';
|
|
stripped_val = strstrip(stripped_val_buf);
|
|
|
|
@@ -318,7 +318,7 @@ static int handle_poweroff_setting_param_set(const char *val, const struct kerne
|
|
char stripped_val_buf[2];
|
|
|
|
// Copy provided value to buffer and strip it of newlines
|
|
- strncpy(stripped_val_buf, val, 2);
|
|
+ strscpy(stripped_val_buf, val, 2);
|
|
stripped_val_buf[1] = '\0';
|
|
stripped_val = strstrip(stripped_val_buf);
|
|
|
|
@@ -368,7 +368,7 @@ static int shutdown_grace_param_set(const char *val, const struct kernel_param *
|
|
char stripped_val_buf[4];
|
|
|
|
// Copy provided value to buffer and strip it of newlines
|
|
- strncpy(stripped_val_buf, val, 4);
|
|
+ strscpy(stripped_val_buf, val, 4);
|
|
stripped_val_buf[3] = '\0';
|
|
stripped_val = strstrip(stripped_val_buf);
|
|
|
|
@@ -386,6 +386,8 @@ module_param_cb(shutdown_grace, &shutdown_grace_param_ops, &shutdown_grace_setti
|
|
MODULE_PARM_DESC(shutdown_grace_setting, "Set delay in seconds from shutdown signal to poweroff");
|
|
|
|
// Path to Sharp DRM device
|
|
+// Unused Function
|
|
+/*
|
|
static int sharp_path_param_set(const char *val, const struct kernel_param *kp)
|
|
{
|
|
char *stripped_val;
|
|
@@ -400,6 +402,7 @@ static int sharp_path_param_set(const char *val, const struct kernel_param *kp)
|
|
? param_set_charp(stripped_val, kp)
|
|
: -EINVAL;
|
|
}
|
|
+*/
|
|
|
|
static const struct kernel_param_ops sharp_path_param_ops = {
|
|
.set = param_set_charp,
|
|
@@ -416,7 +419,7 @@ static int sysfs_gid_param_set(const char *val, const struct kernel_param *kp)
|
|
char stripped_val_buf[11];
|
|
|
|
// Copy provided value to buffer and strip it of newlines
|
|
- strncpy(stripped_val_buf, val, 11);
|
|
+ strscpy(stripped_val_buf, val, 11);
|
|
stripped_val_buf[10] = '\0';
|
|
stripped_val = strstrip(stripped_val_buf);
|
|
|
|
@@ -449,7 +452,7 @@ static int auto_off_setting_param_set(const char *val, const struct kernel_param
|
|
char stripped_val_buf[2];
|
|
|
|
// Copy provided value to buffer and strip it of newlines
|
|
- strncpy(stripped_val_buf, val, 2);
|
|
+ strscpy(stripped_val_buf, val, 2);
|
|
stripped_val_buf[1] = '\0';
|
|
stripped_val = strstrip(stripped_val_buf);
|
|
|