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: <20250106165900.GL5556@nvidia.com>
Date: Mon, 6 Jan 2025 12:59:00 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: kevin.tian@...el.com, will@...nel.org, corbet@....net, joro@...tes.org,
	suravee.suthikulpanit@....com, robin.murphy@....com,
	dwmw2@...radead.org, baolu.lu@...ux.intel.com, shuah@...nel.org,
	linux-kernel@...r.kernel.org, iommu@...ts.linux.dev,
	linux-arm-kernel@...ts.infradead.org,
	linux-kselftest@...r.kernel.org, linux-doc@...r.kernel.org,
	eric.auger@...hat.com, jean-philippe@...aro.org, mdf@...nel.org,
	mshavit@...gle.com, shameerali.kolothum.thodi@...wei.com,
	smostafa@...gle.com, ddutile@...hat.com, yi.l.liu@...el.com,
	patches@...ts.linux.dev
Subject: Re: [PATCH v3 06/14] iommufd: Add IOMMUFD_OBJ_VIRQ and
 IOMMUFD_CMD_VIRQ_ALLOC

On Thu, Jan 02, 2025 at 07:30:21PM -0800, Nicolin Chen wrote:
> On Thu, Jan 02, 2025 at 04:52:46PM -0400, Jason Gunthorpe wrote:
> > On Tue, Dec 17, 2024 at 09:00:19PM -0800, Nicolin Chen wrote:
> > > +/* An iommufd_virq_header packs a vIOMMU interrupt in an iommufd_virq queue */
> > > +struct iommufd_virq_header {
> > > +	struct list_head node;
> > > +	ssize_t irq_len;
> > > +	void *irq_data;
> > > +};
> > 
> > Based on how it is used in iommufd_viommu_report_irq()
> > 
> > +       header = kzalloc(sizeof(*header) + irq_len, GFP_KERNEL);
> > +       header->irq_data = (void *)header + sizeof(*header);
> > +       memcpy(header->irq_data, irq_ptr, irq_len);
> > 
> > It should be a flex array and use the various flexarray tools
> > 
> > struct iommufd_virq_header {
> >        ssize_t irq_len;
> >        u64 irq_data[] __counted_by(irq_len);
> > }
> 
> Changed to
> -------------------------------------------------------------------------
> /* An iommufd_vevent represents a vIOMMU event in an iommufd_veventq */
> struct iommufd_vevent {
> 	struct list_head node;
> 	ssize_t data_len;
> 	u64 event_data[] __counted_by(data_len);
> };
> [...]
> 	vevent = kmalloc(struct_size(vevent, event_data, data_len), GFP_KERNEL);
> -	header->irq_data = (void *)header + sizeof(*header);
> -------------------------------------------------------------------------

Yeah, that's right

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ