Re: [PATCH rdma-next v1 04/48] RDMA/cm: Add SET/GET implementations to hide IBA wire format

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

 



On Thu, Nov 21, 2019 at 08:38:40PM +0000, Jason Gunthorpe wrote:
> On Thu, Nov 21, 2019 at 08:12:29PM +0200, Leon Romanovsky wrote:
> > +#define _IBA_GET_MEM(field_struct, field_offset, byte_size, ptr, out, bytes)   \
> > +	({                                                                     \
> > +		WARN_ON(bytes > byte_size);                                    \
> > +		if (out && bytes) {                                            \
>
> Why check for null? Caller should handle
>
> > +			const field_struct *_ptr = ptr;                        \
> > +			memcpy(out, (void *)_ptr + (field_offset), bytes);     \
> > +		}                                                              \
> > +	})
> > +#define IBA_GET_MEM(field, ptr, out, bytes) _IBA_GET_MEM(field, ptr, out, bytes)
>
> This should really have some type safety, ie check that out is
> something like 'struct ibv_guid *'a

This GET_MEM is not used yet, because I didn't find a way to model
properly access to private_data, ari, info and GIDs at the same time.

We can drop this chunk if it bothers you.

Thanks

>
> 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