v3->lmm_stripe_count = cpu_to_le16(lo->ldo_def_stripenr);
v3->lmm_stripe_offset = cpu_to_le16(lo->ldo_def_stripe_offset);
v3->lmm_stripe_size = cpu_to_le32(lo->ldo_def_stripe_size);
- if (lo->ldo_pool != NULL)
+ if (lo->ldo_pool != NULL) {
strlcpy(v3->lmm_pool_name, lo->ldo_pool,
sizeof(v3->lmm_pool_name));
+ v3->lmm_pool_name[sizeof(v3->lmm_pool_name) - 1] = '\0';
+ }
info->lti_buf.lb_buf = v3;
info->lti_buf.lb_len = sizeof(*v3);
rc = dt_xattr_set(env, next, &info->lti_buf, XATTR_NAME_LOV, 0, th,
GOTO(out, rc = -EINVAL);
}
- /* an offset of -1 is treated as a "special" valid offset */
stripe_offset = le16_to_cpu(lum->lmm_stripe_offset);
- if (stripe_offset != (typeof(stripe_offset))-1) {
+ if (stripe_offset != LOV_OFFSET_DEFAULT) {
/* if offset is not within valid range [0, osts_size) */
if (stripe_offset >= d->lod_osts_size) {
CDEBUG(D_IOCTL, "stripe offset %u >= bitmap size %u\n",
if (pool == NULL)
goto out;
- if (stripe_offset != (typeof(stripe_offset))-1) {
+ if (stripe_offset != LOV_OFFSET_DEFAULT) {
rc = lod_check_index_in_pool(stripe_offset, pool);
if (rc < 0)
GOTO(out, rc = -EINVAL);