public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Hans J. Koch" <hjk@hansjkoch.de>
To: Hillf Danton <dhillf@gmail.com>
Cc: linux-kernel@vger.kernel.org, Greg KH <gregkh@suse.de>
Subject: Re: [PATCH] uio: fix finding mm index for vma
Date: Mon, 28 Mar 2011 23:33:26 +0200	[thread overview]
Message-ID: <20110328213325.GB2786@local> (raw)
In-Reply-To: <AANLkTim3jJi4ZMZHGztyS==wCJ5C-tLbRe99Qj0YnDe3@mail.gmail.com>

On Sun, Mar 27, 2011 at 03:58:19PM +0800, Hillf Danton wrote:

(Added Greg KH to Cc:)

Please Cc: Greg and me when posting patches for UIO.

> When finding mm index for vma it looks more flexible that the mm could
> be sparse, and
> both the size of mm and the pgoff of vma could give correct selection.

Nice improvement!

Thanks for your contribution,
Hans

> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>

Signed-off-by: Hans J. Koch <hjk@hansjkoch.de>

> ---
> 
> --- a/drivers/uio/uio.c	2011-01-05 08:50:20.000000000 +0800
> +++ b/drivers/uio/uio.c	2011-03-27 14:33:02.000000000 +0800
> @@ -587,14 +587,12 @@ static ssize_t uio_write(struct file *fi
> 
>  static int uio_find_mem_index(struct vm_area_struct *vma)
>  {
> -	int mi;
>  	struct uio_device *idev = vma->vm_private_data;
> 
> -	for (mi = 0; mi < MAX_UIO_MAPS; mi++) {
> -		if (idev->info->mem[mi].size == 0)
> +	if (vma->vm_pgoff < MAX_UIO_MAPS) {
> +		if (idev->info->mem[vma->vm_pgoff].size == 0)
>  			return -1;
> -		if (vma->vm_pgoff == mi)
> -			return mi;
> +		return (int)vma->vm_pgoff;
>  	}
>  	return -1;
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

      reply	other threads:[~2011-03-28 21:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27  7:58 [PATCH] uio: fix finding mm index for vma Hillf Danton
2011-03-28 21:33 ` Hans J. Koch [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=20110328213325.GB2786@local \
    --to=hjk@hansjkoch.de \
    --cc=dhillf@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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