lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 21 Dec 2011 02:59:35 +0100
From:	"Hans J. Koch" <hjk@...sjkoch.de>
To:	Ben Hutchings <ben@...adent.org.uk>
Cc:	"Hans J. Koch" <hjk@...sjkoch.de>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/8] uio: Pass pointers to virt_to_page(), not integers

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@...adent.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
> 
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ