Re: [PATCH v6 05/14] iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 18, 2025 at 09:47:50AM -0800, Nicolin Chen wrote:
> I think we can do:
> 	if (!list_empty(list)) {
> 		struct iommufd_vevent *next;
> 
> 		next = list_first_entry(list, struct iommufd_vevent, node);
> 		if (next == &veventq->overflow) {
> 			/* Make a copy of the overflow node for copy_to_user */
> 			vevent = kzalloc(sizeof(*vevent), GFP_ATOMIC);
> 			if (!vevent)
> 				goto out_unlock;
> 		}
> 		list_del(&next->node);
> 		if (vevent)
> 			memcpy(vevent, next, sizeof(*vevent));
> 		else
> 			vevent = next;
> 	}

That looks right

> > > +int iommufd_veventq_alloc(struct iommufd_ucmd *ucmd)
> > > +{
> > > +	struct iommu_veventq_alloc *cmd = ucmd->cmd;
> > > +	struct iommufd_veventq *veventq;
> > > +	struct iommufd_viommu *viommu;
> > > +	int fdno;
> > > +	int rc;
> > > +
> > > +	if (cmd->flags || cmd->type == IOMMU_VEVENTQ_TYPE_DEFAULT)
> > > +		return -EOPNOTSUPP;
> > > +	if (!cmd->veventq_depth)
> > > +		return -EINVAL;
> > 
> > Check __reserved for 0 too
> 
> Kevin is suggesting a 32-bit flag field, so I think we can drop
> the __reserved in that case.

Those are different structs?

Jason




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux