Commit f89672cc authored by Alistair Delva's avatar Alistair Delva Committed by Bjorn Andersson

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: 3afdc59e ("remoteproc: Add coredump debugfs entry")
Signed-off-by: default avatarAlistair 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: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220119232139.1125908-1-adelva@google.com
parent ae6062c4
...@@ -76,7 +76,7 @@ static ssize_t rproc_coredump_write(struct file *filp, ...@@ -76,7 +76,7 @@ static ssize_t rproc_coredump_write(struct file *filp,
int ret, err = 0; int ret, err = 0;
char buf[20]; char buf[20];
if (count > sizeof(buf)) if (count < 1 || count > sizeof(buf))
return -EINVAL; return -EINVAL;
ret = copy_from_user(buf, user_buf, count); ret = copy_from_user(buf, user_buf, count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment