|
@@ -257,7 +257,8 @@ static ssize_t iwl_dbgfs_power_down_allow_write(struct file *file,
|
|
|
if (!mvm->ucode_loaded)
|
|
|
return -EIO;
|
|
|
|
|
|
- if (copy_from_user(buf, user_buf, sizeof(buf)))
|
|
|
+ count = min_t(size_t, count, sizeof(buf) - 1);
|
|
|
+ if (copy_from_user(buf, user_buf, count))
|
|
|
return -EFAULT;
|
|
|
|
|
|
if (sscanf(buf, "%d", &allow) != 1)
|
|
@@ -281,7 +282,8 @@ static ssize_t iwl_dbgfs_power_down_d3_allow_write(struct file *file,
|
|
|
char buf[8] = {};
|
|
|
int allow;
|
|
|
|
|
|
- if (copy_from_user(buf, user_buf, sizeof(buf)))
|
|
|
+ count = min_t(size_t, count, sizeof(buf) - 1);
|
|
|
+ if (copy_from_user(buf, user_buf, count))
|
|
|
return -EFAULT;
|
|
|
|
|
|
if (sscanf(buf, "%d", &allow) != 1)
|
|
@@ -371,7 +373,8 @@ static ssize_t iwl_dbgfs_pm_params_write(struct file *file,
|
|
|
int val;
|
|
|
int ret;
|
|
|
|
|
|
- if (copy_from_user(buf, user_buf, sizeof(buf)))
|
|
|
+ count = min_t(size_t, count, sizeof(buf) - 1);
|
|
|
+ if (copy_from_user(buf, user_buf, count))
|
|
|
return -EFAULT;
|
|
|
|
|
|
if (!strncmp("keep_alive=", buf, 11)) {
|
|
@@ -1021,7 +1024,8 @@ static ssize_t iwl_dbgfs_d3_sram_write(struct file *file,
|
|
|
char buf[8] = {};
|
|
|
int store;
|
|
|
|
|
|
- if (copy_from_user(buf, user_buf, sizeof(buf)))
|
|
|
+ count = min_t(size_t, count, sizeof(buf) - 1);
|
|
|
+ if (copy_from_user(buf, user_buf, count))
|
|
|
return -EFAULT;
|
|
|
|
|
|
if (sscanf(buf, "%d", &store) != 1)
|