Linux Media Controller development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-staging@lists.linux.dev
Subject: Re: [RFC] media: atomisp: change copy_from_compatible to iov_iter
Date: Wed, 8 Apr 2026 17:25:35 +0300	[thread overview]
Message-ID: <adZlX-5rx0jtIMpD@ashevche-desk.local> (raw)
In-Reply-To: <20260408134612.1380-1-joshua.crofts1@gmail.com>

On Wed, Apr 08, 2026 at 01:46:11PM +0000, Joshua Crofts wrote:
> Since the atomisp driver concerns transferring video
> data, it would probably be better to use an iov_iter
> than copy_to_user calls (scatter-gather i/o and better
> pointer safety). Per yesterday's emails, I'm sending an
> an example of a function in atomisp_cmd.c where I've
> implemented iov_iter usage.
> 
> Note, this isn't a patch, more of a question whether this
> style of changing the copy_to_user calls is valid (or if
> I'm writing garbage code). I'd rather get your opinion
> than submitting a patch first.

...

> -	ret = copy_to_user(config->data, asd->params.s3a_user_stat->data,
> -			   asd->params.s3a_output_bytes);
> -	if (ret) {
> -		dev_err(isp->dev, "copy to user failed: copied %lu bytes\n",
> -			ret);
> +	ret = import_ubuf(ITER_DEST, (void __user *)config->data, asd->params.s3a_output_bytes, &iter);
> +	if (ret)
> +		return ret;
> +
> +	if (copy_to_iter(asd->params.s3a_user_stat->data, asd->params.s3a_output_bytes, &iter) != asd->params.s3a_output_bytes)
>  		return -EFAULT;
> -	}

It doesn't change any architectural decision here. Basically you need to have
s3a_output_bytes to be already iov_iter at this point. So, import_ubuf() has to
happen somewhere else.


-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2026-04-08 14:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 14:46 [RFC] staging: media: atomisp: change copy_from_compatible to iov_iter Joshua Crofts
2026-04-07 15:06 ` Andy Shevchenko
2026-04-07 15:12   ` Andy Shevchenko
2026-04-08 13:46     ` [RFC] " Joshua Crofts
2026-04-08 13:50       ` Joshua Crofts
2026-04-08 14:25       ` Andy Shevchenko [this message]
2026-04-08 14:29         ` Andy Shevchenko
2026-04-08 14:43           ` Joshua Crofts

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=adZlX-5rx0jtIMpD@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox