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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131126191525.GA29279@kroah.com>
Date:	Tue, 26 Nov 2013 11:15:25 -0800
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	Ashutosh Dixit <ashutosh.dixit@...el.com>
Cc:	Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
	virtualization@...ts.linux-foundation.org,
	Dasaratharaman Chandramouli 
	<dasaratharaman.chandramouli@...el.com>,
	Sudeep Dutt <sudeep.dutt@...el.com>,
	Nikhil Rao <nikhil.rao@...el.com>,
	Siva Krishna Kumar Reddy Yerramreddy 
	<siva.krishna.kumar.reddy.yerramreddy@...el.com>,
	Caz Yokoyama <Caz.Yokoyama@...el.com>,
	Fengguang Wu <fengguang.wu@...el.com>
Subject: Re: [PATCH char-misc-linus 4/5] misc: mic: Fix sparse warnings and
 other endianness issues.

On Tue, Nov 26, 2013 at 10:14:21AM -0800, Ashutosh Dixit wrote:
> Endianness issues are now consistent as per the documentation in
> host/mic_virtio.h. Note that the host can be both BE or LE whereas the
> card is always LE.
> 
> Memory space sparse warnings are fixed for now by using __force. This is
> sufficient for now since the driver depends on x86 but will need to be
> revisited if we support other architectures which treat I/O memory
> differently from system memory.

There's no need for this for 3.13-final, right?  No bug fixes are here
that I can tell.

And don't use __force, really, can't you fix this some other way?

> diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c
> index 4dce912..c975c36 100644
> --- a/drivers/misc/mic/card/mic_virtio.c
> +++ b/drivers/misc/mic/card/mic_virtio.c
> @@ -248,17 +248,17 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev,
>  	/* First assign the vring's allocated in host memory */
>  	vqconfig = mic_vq_config(mvdev->desc) + index;
>  	memcpy_fromio(&config, vqconfig, sizeof(config));
> -	_vr_size = vring_size(config.num, MIC_VIRTIO_RING_ALIGN);
> +	_vr_size = vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN);
>  	vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info));
> -	va = mic_card_map(mvdev->mdev, config.address, vr_size);
> +	va = mic_card_map(mvdev->mdev, le64_to_cpu(config.address), vr_size);
>  	if (!va)
>  		return ERR_PTR(-ENOMEM);
>  	mvdev->vr[index] = va;
>  	memset_io(va, 0x0, _vr_size);
> -	vq = vring_new_virtqueue(index,
> -				config.num, MIC_VIRTIO_RING_ALIGN, vdev,
> -				false,
> -				va, mic_notify, callback, name);
> +	vq = vring_new_virtqueue(index, le16_to_cpu(config.num),
> +				 MIC_VIRTIO_RING_ALIGN, vdev, false,
> +				 (void __force *)va, mic_notify, callback,
> +				 name);

Why __force a void * here?  That feels wrong.

Can you split the endian fixes up from the user pointer fixes to make it
easier to review/apply?

thanks,

greg k-h
--
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