Lines Matching refs:uattr

137 static bool uverbs_is_attr_cleared(const struct ib_uverbs_attr *uattr,  in uverbs_is_attr_cleared()  argument
140 if (uattr->len > sizeof_field(struct ib_uverbs_attr, data)) in uverbs_is_attr_cleared()
141 return ib_is_buffer_cleared(u64_to_user_ptr(uattr->data) + len, in uverbs_is_attr_cleared()
142 uattr->len - len); in uverbs_is_attr_cleared()
144 return !memchr_inv((const void *)&uattr->data + len, in uverbs_is_attr_cleared()
145 0, uattr->len - len); in uverbs_is_attr_cleared()
166 struct ib_uverbs_attr *uattr, in uverbs_process_idrs_array() argument
175 if (uattr->attr_data.reserved) in uverbs_process_idrs_array()
178 if (uattr->len % sizeof(u32)) in uverbs_process_idrs_array()
181 array_len = uattr->len / sizeof(u32); in uverbs_process_idrs_array()
200 if (uattr->len > sizeof(uattr->data)) { in uverbs_process_idrs_array()
201 ret = copy_from_user(idr_vals, u64_to_user_ptr(uattr->data), in uverbs_process_idrs_array()
202 uattr->len); in uverbs_process_idrs_array()
206 memcpy(idr_vals, &uattr->data, uattr->len); in uverbs_process_idrs_array()
240 struct ib_uverbs_attr *uattr, u32 attr_bkey) in uverbs_process_attr() argument
249 if (uattr->attr_data.enum_data.elem_id >= spec->u.enum_def.num_elems) in uverbs_process_attr()
252 if (uattr->attr_data.enum_data.reserved) in uverbs_process_attr()
255 val_spec = &spec->u2.enum_def.ids[uattr->attr_data.enum_data.elem_id]; in uverbs_process_attr()
261 e->ptr_attr.enum_id = uattr->attr_data.enum_data.elem_id; in uverbs_process_attr()
269 if (uattr->len > val_spec->u.ptr.len && in uverbs_process_attr()
271 !uverbs_is_attr_cleared(uattr, val_spec->u.ptr.len)) in uverbs_process_attr()
276 if (uattr->len < val_spec->u.ptr.min_len || in uverbs_process_attr()
278 uattr->len > val_spec->u.ptr.len)) in uverbs_process_attr()
282 uattr->attr_data.reserved) in uverbs_process_attr()
285 e->ptr_attr.uattr_idx = uattr - pbundle->uattrs; in uverbs_process_attr()
286 e->ptr_attr.len = uattr->len; in uverbs_process_attr()
291 p = uverbs_alloc(&pbundle->bundle, uattr->len); in uverbs_process_attr()
297 if (copy_from_user(p, u64_to_user_ptr(uattr->data), in uverbs_process_attr()
298 uattr->len)) in uverbs_process_attr()
301 e->ptr_attr.data = uattr->data; in uverbs_process_attr()
307 if (uattr->attr_data.reserved) in uverbs_process_attr()
310 if (uattr->len != 0) in uverbs_process_attr()
324 uattr->data_s64, &pbundle->bundle); in uverbs_process_attr()
330 unsigned int uattr_idx = uattr - pbundle->uattrs; in uverbs_process_attr()
341 if (uattr->attr_data.reserved || uattr->len != 0 || in uverbs_process_attr()
342 uattr->data_s64 < INT_MIN || uattr->data_s64 > INT_MAX) in uverbs_process_attr()
345 e->ptr_attr.data = uattr->data_s64; in uverbs_process_attr()
350 &e->objs_arr_attr, uattr, in uverbs_process_attr()
388 struct ib_uverbs_attr *uattr) in uverbs_set_attr() argument
390 u32 attr_key = uapi_key_attr(uattr->attr_id); in uverbs_set_attr()
402 if (uattr->flags & UVERBS_ATTR_F_MANDATORY) in uverbs_set_attr()
412 ret = uverbs_process_attr(pbundle, attr, uattr, attr_bkey); in uverbs_set_attr()