- buf = mdd_buf_get(env, mdd_env_info(env)->mti_xattr_buf,
- sizeof(mdd_env_info(env)->mti_xattr_buf));
- rc = mdo_xattr_get(env, obj, buf, XATTR_NAME_ACL_ACCESS);
+ lu_buf_check_and_alloc(&mdd_env_info(env)->mti_xattr_buf,
+ MIN(mdd_obj2mdd_dev(obj)->mdd_dt_conf.ddp_max_ea_size,
+ XATTR_SIZE_MAX));
+ buf = mdd_env_info(env)->mti_xattr_buf;
+ if (buf.lb_buf == NULL)
+ RETURN(-ENOMEM);
+
+ if (buf.lb_len > XATTR_SIZE_MAX)
+ buf.lb_len = XATTR_SIZE_MAX;
+
+ rc = mdo_xattr_get(env, obj, &buf, XATTR_NAME_ACL_ACCESS);