+ stripe_count = le16_to_cpu(lum->lmm_stripe_count);
+ if (magic == LOV_USER_MAGIC_V1 || magic == LOV_MAGIC_V1_DEF)
+ lum_size = offsetof(struct lov_user_md_v1,
+ lmm_objects[stripe_count]);
+ else if (magic == LOV_USER_MAGIC_V3 || magic == LOV_MAGIC_V3_DEF)
+ lum_size = offsetof(struct lov_user_md_v3,
+ lmm_objects[stripe_count]);
+ else
+ LBUG();
+
+ if (specific && buf->lb_len != lum_size) {
+ CDEBUG(D_IOCTL, "invalid buf len %zd for lov_user_md with "
+ "magic %#x and stripe_count %u\n",
+ buf->lb_len, magic, stripe_count);
+ GOTO(out, rc = -EINVAL);
+ }