Re: [PATCH v1 05/10] IB/uverbs: Remove the ib_uverbs_attr pointer from each attr

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

 



On Tue, Aug 21, 2018 at 08:01:50AM -0600, Guy Levi(SW) wrote:

> > +int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx,
> > +		   const void *from, size_t size)
> > +{
> > +	struct bundle_priv *pbundle =
> > +		container_of(bundle, struct bundle_priv, bundle);
> > +	const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx);
> > +	u16 flags;
> > +	size_t min_size;
> > +
> > +	if (IS_ERR(attr))
> > +		return PTR_ERR(attr);
> > +
> > +	min_size = min_t(size_t, attr->ptr_attr.len, size);
> > +	if (copy_to_user(u64_to_user_ptr(attr->ptr_attr.data), from, min_size))
> > +		return -EFAULT;
> 
> The u64_to_user_ptr can be done once at the parsing stage.

Something like that could be a good patch.. I was looking at this area
and thinking alot of it still doesn't make much sense :|

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux