From: "Hans J. Koch" <hjk@hansjkoch.de>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>,
Greg Kroah-Hartman <gregkh@suse.de>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/8] uio: Pass pointers to virt_to_page(), not integers
Date: Wed, 21 Dec 2011 02:59:35 +0100 [thread overview]
Message-ID: <20111221015934.GA27441@local> (raw)
In-Reply-To: <1324431393.2844.153.camel@deadeye>
On Wed, Dec 21, 2011 at 01:36:33AM +0000, Ben Hutchings wrote:
> Most architectures define virt_to_page() as a macro that casts its
> argument such that an argument of type unsigned long will be accepted
> without complaint. However, the proper type is void *, and passing
> unsigned long results in a warning on MIPS.
Not only on MIPS... This is already fixed in Greg's tree and will go
to mainline in the next merge window.
Thanks,
Hans
>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> It might be clearer to assign:
>
> addr = (void *)((unsigned long)idev->info->mem[mi].addr + offset);
>
> since arithmetic on void pointers is weird. Either way should work though.
>
> Ben.
>
> drivers/uio/uio.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
> index a783d53..1ff7927 100644
> --- a/drivers/uio/uio.c
> +++ b/drivers/uio/uio.c
> @@ -620,6 +620,7 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> struct uio_device *idev = vma->vm_private_data;
> struct page *page;
> unsigned long offset;
> + void *addr;
>
> int mi = uio_find_mem_index(vma);
> if (mi < 0)
> @@ -631,10 +632,11 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> */
> offset = (vmf->pgoff - mi) << PAGE_SHIFT;
>
> + addr = (void *)(unsigned long)idev->info->mem[mi].addr + offset;
> if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL)
> - page = virt_to_page(idev->info->mem[mi].addr + offset);
> + page = virt_to_page(addr);
> else
> - page = vmalloc_to_page((void *)(unsigned long)idev->info->mem[mi].addr + offset);
> + page = vmalloc_to_page(addr);
> get_page(page);
> vmf->page = page;
> return 0;
> --
> 1.7.7.3
>
>
>
>
next prev parent reply other threads:[~2011-12-21 2:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-21 1:29 [PATCH 0/8] Fix virtual and physical address types Ben Hutchings
2011-12-21 1:32 ` [PATCH 1/8] IB/cxgb4: Fix formatting of physical address Ben Hutchings
2011-12-21 2:35 ` Joe Perches
2011-12-21 2:47 ` Ben Hutchings
2011-12-22 19:52 ` Valdis.Kletnieks
2011-12-21 14:12 ` Steve Wise
2011-12-21 1:32 ` [PATCH 2/8] farsync: Fix confusion about DMA address and buffer offset types Ben Hutchings
2011-12-21 4:46 ` David Miller
2011-12-21 5:41 ` Ben Hutchings
2011-12-21 8:33 ` Kevin Curtis
2011-12-21 1:33 ` [PATCH 3/8] drm: Do not include page offset in argument to virt_to_page() Ben Hutchings
2011-12-21 1:33 ` [PATCH 4/8] drm: Pass pointers " Ben Hutchings
2011-12-21 1:34 ` [PATCH 5/8] [SCSI] tgt: Pass pointers to virt_to_page(), not integers Ben Hutchings
2011-12-21 1:36 ` [PATCH 6/8] uio: " Ben Hutchings
2011-12-21 1:59 ` Hans J. Koch [this message]
2011-12-21 1:36 ` [PATCH 7/8] rds: " Ben Hutchings
2011-12-21 1:37 ` [PATCH 8/8] pmcraid: Pass pointers to access_ok(), " Ben Hutchings
-- strict thread matches above, loose matches on Subject: below --
2013-10-27 21:47 [PATCH 0/8] Fix minor address type errors Ben Hutchings
2013-10-27 21:53 ` [PATCH 6/8] uio: Pass pointers to virt_to_page(), not integers Ben Hutchings
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=20111221015934.GA27441@local \
--to=hjk@hansjkoch.de \
--cc=ben@decadent.org.uk \
--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