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: <1855e4d2-02da-4ea1-94b3-8daf044b1243@moroto.mountain>
Date: Sun, 9 Jun 2024 18:33:11 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Fred Griffoul <fgriffo@...zon.co.uk>
Cc: griffoul@...il.com, Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will@...nel.org>,
	Alex Williamson <alex.williamson@...hat.com>,
	Waiman Long <longman@...hat.com>,
	Zefan Li <lizefan.x@...edance.com>, Tejun Heo <tj@...nel.org>,
	Johannes Weiner <hannes@...xchg.org>,
	Mark Rutland <mark.rutland@....com>, Marc Zyngier <maz@...nel.org>,
	Oliver Upton <oliver.upton@...ux.dev>,
	Mark Brown <broonie@...nel.org>, Ard Biesheuvel <ardb@...nel.org>,
	Joey Gouly <joey.gouly@....com>,
	Ryan Roberts <ryan.roberts@....com>,
	Jeremy Linton <jeremy.linton@....com>,
	Jason Gunthorpe <jgg@...pe.ca>, Yi Liu <yi.l.liu@...el.com>,
	Kevin Tian <kevin.tian@...el.com>,
	Eric Auger <eric.auger@...hat.com>,
	Stefan Hajnoczi <stefanha@...hat.com>,
	Christian Brauner <brauner@...nel.org>,
	Ankit Agrawal <ankita@...dia.com>,
	Reinette Chatre <reinette.chatre@...el.com>,
	Ye Bin <yebin10@...wei.com>, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
	cgroups@...r.kernel.org
Subject: Re: [PATCH v4 2/2] vfio/pci: add msi interrupt affinity support

On Fri, Jun 07, 2024 at 07:09:49PM +0000, Fred Griffoul wrote:
> diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
> index e97d796a54fb..e87131d45059 100644
> --- a/drivers/vfio/vfio_main.c
> +++ b/drivers/vfio/vfio_main.c
> @@ -1505,23 +1505,28 @@ int vfio_set_irqs_validate_and_prepare(struct vfio_irq_set *hdr, int num_irqs,
>  		size = 0;
>  		break;
>  	case VFIO_IRQ_SET_DATA_BOOL:
> -		size = sizeof(uint8_t);
> +		size = hdr->count * sizeof(uint8_t);
>  		break;
>  	case VFIO_IRQ_SET_DATA_EVENTFD:
> -		size = sizeof(int32_t);
> +		size = hdr->count * sizeof(int32_t);

Not related to your patch, but this multiply can integer overflow on
32bit systems.  Better to use size_mul().

regards,
dan carpenter

> +		break;
> +	case VFIO_IRQ_SET_DATA_AFFINITY:
> +		size = hdr->argsz - minsz;
> +		if (size > cpumask_size())
> +			size = cpumask_size();
>  		break;
>  	default:
>  		return -EINVAL;
>  	}
>  
>  	if (size) {
> -		if (hdr->argsz - minsz < hdr->count * size)
> +		if (hdr->argsz - minsz < size)
>  			return -EINVAL;
>  
>  		if (!data_size)
>  			return -EINVAL;
>  
> -		*data_size = hdr->count * size;
> +		*data_size = size;
>  	}
>  
>  	return 0;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ