qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] nbd/trivial: fix type cast for ioctl


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] nbd/trivial: fix type cast for ioctl
Date: Fri, 03 Apr 2015 16:15:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 03/04/2015 13:01, Bogdan Purcareata wrote:
> This fixes ioctl behavior on powerpc e6500 platforms with 64bit kernel and 
> 32bit
> userspace. The current type cast has no effect there and the value passed to 
> the
> kernel is still 0. Probably an issue related to the compiler, since I'm 
> assuming
> the same configuration works on a similar setup on x86.
> 
> Also ensure consistency with previous type cast in TRACE message.
> 
> Signed-off-by: Bogdan Purcareata <address@hidden>
> ---
>  nbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nbd.c b/nbd.c
> index 91b7d56..da81a5b 100644
> --- a/nbd.c
> +++ b/nbd.c
> @@ -681,7 +681,7 @@ int nbd_init(int fd, int csock, uint32_t flags, off_t 
> size)
>  
>      TRACE("Setting size to %zd block(s)", (size_t)(size / BDRV_SECTOR_SIZE));
>  
> -    if (ioctl(fd, NBD_SET_SIZE_BLOCKS, size / (size_t)BDRV_SECTOR_SIZE) < 0) 
> {
> +    if (ioctl(fd, NBD_SET_SIZE_BLOCKS, (size_t)(size / BDRV_SECTOR_SIZE) < 
> 0)) {
>          int serrno = errno;
>          LOG("Failed setting size (in blocks)");
>          return -serrno;
> 

Thanks, queued for 2.4.

Cc: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]