Skip to content

Commit 6396fea

Browse files
mhaimovskiogabbay
authored andcommitted
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 <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
1 parent f75aef3 commit 6396fea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/misc/habanalabs/common/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ static ssize_t hl_clk_gate_read(struct file *f, char __user *buf,
982982
return 0;
983983

984984
sprintf(tmp_buf, "0x%llx\n", hdev->clock_gating_mask);
985-
rc = simple_read_from_buffer(buf, strlen(tmp_buf) + 1, ppos, tmp_buf,
985+
rc = simple_read_from_buffer(buf, count, ppos, tmp_buf,
986986
strlen(tmp_buf) + 1);
987987

988988
return rc;

0 commit comments

Comments
 (0)