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 *' Jason