From: Dan Carpenter <dan.carpenter@linaro.org>
To: Fred Griffoul <fgriffo@amazon.co.uk>
Cc: griffoul@gmail.com, Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Alex Williamson <alex.williamson@redhat.com>,
Waiman Long <longman@redhat.com>,
Zefan Li <lizefan.x@bytedance.com>, Tejun Heo <tj@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Mark Rutland <mark.rutland@arm.com>,
Marc Zyngier <maz@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>,
Mark Brown <broonie@kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
Joey Gouly <joey.gouly@arm.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Jeremy Linton <jeremy.linton@arm.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Yi Liu <yi.l.liu@intel.com>,
Kevin Tian <kevin.tian@intel.com>,
Eric Auger <eric.auger@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Christian Brauner <brauner@kernel.org>,
Ankit Agrawal <ankita@nvidia.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Ye Bin <yebin10@huawei.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
cgroups@vger.kernel.org
Subject: Re: [PATCH v4 2/2] vfio/pci: add msi interrupt affinity support
Date: Sun, 9 Jun 2024 18:33:11 +0300 [thread overview]
Message-ID: <1855e4d2-02da-4ea1-94b3-8daf044b1243@moroto.mountain> (raw)
In-Reply-To: <20240607190955.15376-3-fgriffo@amazon.co.uk>
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;
next prev parent reply other threads:[~2024-06-09 15:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 19:09 [PATCH v3 0/2] " Fred Griffoul
2024-06-07 19:09 ` [PATCH v4 1/2] cgroup/cpuset: export cpuset_cpus_allowed() Fred Griffoul
2024-06-07 19:09 ` [PATCH v4 2/2] vfio/pci: add msi interrupt affinity support Fred Griffoul
2024-06-09 15:29 ` Dan Carpenter
2024-06-10 8:21 ` Frederic Griffoul
2024-06-09 15:33 ` Dan Carpenter [this message]
2024-06-10 3:58 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1855e4d2-02da-4ea1-94b3-8daf044b1243@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=ankita@nvidia.com \
--cc=ardb@kernel.org \
--cc=brauner@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=cgroups@vger.kernel.org \
--cc=eric.auger@redhat.com \
--cc=fgriffo@amazon.co.uk \
--cc=griffoul@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=jeremy.linton@arm.com \
--cc=jgg@ziepe.ca \
--cc=joey.gouly@arm.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=reinette.chatre@intel.com \
--cc=ryan.roberts@arm.com \
--cc=stefanha@redhat.com \
--cc=tj@kernel.org \
--cc=will@kernel.org \
--cc=yebin10@huawei.com \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®