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] [day] [month] [year] [list]
Message-ID: <20250511113555-mutt-send-email-mst@kernel.org>
Date: Sun, 11 May 2025 11:36:13 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: SamiUddinsami.md.ko@...il.com
Cc: jasowang@...hat.com, xuanzhuo@...ux.alibaba.com, eperezma@...hat.com,
	virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Sami Uddin <sami.md.ko@...il.com>
Subject: Re: [PATCH v2] virtio: reject shm region if length is zero

On Sun, May 11, 2025 at 09:14:28PM +0930, SamiUddinsami.md.ko@...il.com wrote:
> From: Sami Uddin <sami.md.ko@...il.com>
> 
> Prevent usage of shared memory regions where the length is zero,
> as such configurations are not valid and may lead to unexpected behavior.
> 
> Signed-off-by: Sami Uddin <sami.md.ko@...il.com>
> ---
> v2:
> - Fixed coding style issue: added space after 'if' statement
> 
>  include/linux/virtio_config.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> index 169c7d367fac..b641b16d42ef 100644
> --- a/include/linux/virtio_config.h
> +++ b/include/linux/virtio_config.h
> @@ -329,6 +329,8 @@ static inline
>  bool virtio_get_shm_region(struct virtio_device *vdev,
>  			   struct virtio_shm_region *region, u8 id)
>  {
> +	if (region->len == 0)
> +		return false;

if (!region->len)

is more idiomatic

>  	if (!vdev->config->get_shm_region)
>  		return false;
>  	return vdev->config->get_shm_region(vdev, region, id);
> -- 
> 2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ