All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Qianfeng Rong <rongqianfeng@vivo.com>
Cc: Hans de Goede <hansg@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Andy Shevchenko <andy@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH] media: atomisp: Use vmemdup_user() instead of open-coding
Date: Wed, 20 Aug 2025 18:01:00 +0300	[thread overview]
Message-ID: <aKXjLOvJbpeMZaCv@smile.fi.intel.com> (raw)
In-Reply-To: <20250814133032.236533-1-rongqianfeng@vivo.com>

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



      parent reply	other threads:[~2025-08-20 15:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 13:30 [PATCH] media: atomisp: Use vmemdup_user() instead of open-coding Qianfeng Rong
2025-08-14 13:42 ` Markus Elfring
2025-08-14 13:58   ` Greg Kroah-Hartman
2025-08-20 15:01 ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aKXjLOvJbpeMZaCv@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=hverkuil@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=rongqianfeng@vivo.com \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.