aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/misc
diff options
context:
space:
mode:
authorMoti Haimovski <mhaimovski@habana.ai>2020-08-19 17:40:33 +0300
committerOded Gabbay <oded.gabbay@gmail.com>2020-08-31 15:10:27 +0300
commit6396feabf7a4104a4ddfecc00b8aac535c631a66 (patch)
treedb334ddac88a5e85ebdc9d9737274f87373fd00d /drivers/misc
parentLinux 5.9-rc3 (diff)
downloadwireguard-linux-6396feabf7a4104a4ddfecc00b8aac535c631a66.tar.xz
wireguard-linux-6396feabf7a4104a4ddfecc00b8aac535c631a66.zip
habanalabs: prevent user buff overflow
This commit fixes a potential debugfs issue that may occur when reading the clock gating mask into the user buffer since the user buffer size was not taken into consideration. Signed-off-by: Moti Haimovski <mhaimovski@habana.ai> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/common/debugfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/habanalabs/common/debugfs.c b/drivers/misc/habanalabs/common/debugfs.c
index 37701e4f9d5a..aa77771635d3 100644
--- a/drivers/misc/habanalabs/common/debugfs.c
+++ b/drivers/misc/habanalabs/common/debugfs.c
@@ -982,7 +982,7 @@ static ssize_t hl_clk_gate_read(struct file *f, char __user *buf,
return 0;
sprintf(tmp_buf, "0x%llx\n", hdev->clock_gating_mask);
- rc = simple_read_from_buffer(buf, strlen(tmp_buf) + 1, ppos, tmp_buf,
+ rc = simple_read_from_buffer(buf, count, ppos, tmp_buf,
strlen(tmp_buf) + 1);
return rc;