[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aKXjLOvJbpeMZaCv@smile.fi.intel.com>
Date: Wed, 20 Aug 2025 18:01:00 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Qianfeng Rong <rongqianfeng@...o.com>
Cc: Hans de Goede <hansg@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Andy Shevchenko <andy@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Hans Verkuil <hverkuil@...nel.org>, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-staging@...ts.linux.dev
Subject: Re: [PATCH] media: atomisp: Use vmemdup_user() instead of open-coding
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
Powered by blists - more mailing lists