drivers/staging/media/atomisp/pci/atomisp_cmd.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
Use vmemdup_user() to get a copy of the user buffer in
atomisp_v4l2_framebuffer_to_css_frame().
Compile-tested only.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/staging/media/atomisp/pci/atomisp_cmd.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index 3a4eb4f6d3be..d6fa1605a096 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -3326,14 +3326,10 @@ atomisp_v4l2_framebuffer_to_css_frame(const struct v4l2_framebuffer *arg,
goto err;
}
- tmp_buf = vmalloc(arg->fmt.sizeimage);
- if (!tmp_buf) {
- ret = -ENOMEM;
- goto err;
- }
- if (copy_from_user(tmp_buf, (void __user __force *)arg->base,
- arg->fmt.sizeimage)) {
- ret = -EFAULT;
+ tmp_buf = vmemdup_user((void __user __force *)arg->base,
+ arg->fmt.sizeimage);
+ if (IS_ERR(tmp_buf)) {
+ ret = PTR_ERR(tmp_buf);
goto err;
}
@@ -3345,7 +3341,8 @@ atomisp_v4l2_framebuffer_to_css_frame(const struct v4l2_framebuffer *arg,
err:
if (ret && res)
ia_css_frame_free(res);
- vfree(tmp_buf);
+ if (!IS_ERR(tmp_buf))
+ kvfree(tmp_buf);
if (ret == 0)
*result = res;
return ret;
--
2.34.1
On Thu, Aug 14, 2025 at 09:30:29PM +0800, Qianfeng Rong wrote: > Use vmemdup_user() to get a copy of the user buffer in > atomisp_v4l2_framebuffer_to_css_frame(). > Compile-tested only. Not sure if it worth to have in the commit message, but at least it doesn't make it ugly. So, up to Hans. ... > + tmp_buf = vmemdup_user((void __user __force *)arg->base, > + arg->fmt.sizeimage); I know this is 85 characters on one line, but I would go as it makes a bit better the readability in my opinion. > + if (IS_ERR(tmp_buf)) { > + ret = PTR_ERR(tmp_buf); > goto err; > } ... > err: > if (ret && res) > ia_css_frame_free(res); > - vfree(tmp_buf); > + if (!IS_ERR(tmp_buf)) > + kvfree(tmp_buf); > if (ret == 0) > *result = res; > return ret; This is messy error handling, but it is definitely out of scope of the proposed patch. -- With Best Regards, Andy Shevchenko
> Use vmemdup_user() to get a copy of the user buffer in > atomisp_v4l2_framebuffer_to_css_frame(). Was an information source (like the following) reused here? https://elixir.bootlin.com/linux/v6.16/source/scripts/coccinelle/api/memdup_user.cocci#L2 Regards, Markus
On Thu, Aug 14, 2025 at 03:42:33PM +0200, Markus Elfring wrote: > > Use vmemdup_user() to get a copy of the user buffer in > > atomisp_v4l2_framebuffer_to_css_frame(). > > Was an information source (like the following) reused here? > https://elixir.bootlin.com/linux/v6.16/source/scripts/coccinelle/api/memdup_user.cocci#L2 > > Regards, > Markus Hi, This is the semi-friendly patch-bot of Greg Kroah-Hartman. Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time. Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all. The person/bot/AI that sent it is being ignored by almost all Linux kernel maintainers for having a persistent pattern of behavior of producing distracting and pointless commentary, and inability to adapt to feedback. Please feel free to also ignore emails from them. thanks, greg k-h's patch email bot
© 2016 - 2025 Red Hat, Inc.