Skip to content

Commit f89672c

Browse files
adelva1984andersson
authored andcommitted
remoteproc: Fix count check in rproc_coredump_write()
Check count for 0, to avoid a potential underflow. Make the check the same as the one in rproc_recovery_write(). Fixes: 3afdc59 ("remoteproc: Add coredump debugfs entry") Signed-off-by: Alistair Delva <adelva@google.com> Cc: Rishabh Bhatnagar <rishabhb@codeaurora.org> Cc: stable@vger.kernel.org Cc: Ohad Ben-Cohen <ohad@wizery.com> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Sibi Sankar <sibis@codeaurora.org> Cc: linux-remoteproc@vger.kernel.org Cc: kernel-team@android.com Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220119232139.1125908-1-adelva@google.com
1 parent ae6062c commit f89672c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/remoteproc/remoteproc_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static ssize_t rproc_coredump_write(struct file *filp,
7676
int ret, err = 0;
7777
char buf[20];
7878

79-
if (count > sizeof(buf))
79+
if (count < 1 || count > sizeof(buf))
8080
return -EINVAL;
8181

8282
ret = copy_from_user(buf, user_buf, count);

0 commit comments

Comments
 (0)