diff options
-rw-r--r-- | drivers/md/bcache/xattr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/bcache/xattr.c b/drivers/md/bcache/xattr.c index 297ef230c4cc..7cdac88c1b3e 100644 --- a/drivers/md/bcache/xattr.c +++ b/drivers/md/bcache/xattr.c @@ -260,11 +260,12 @@ static size_t bch_xattr_emit(struct dentry *dentry, bch_xattr_type_to_handler(xattr->x_type); if (handler && (!handler->list || handler->list(dentry))) { - const size_t prefix_len = strlen(handler->prefix); + const char *prefix = handler->prefix ?: handler->name; + const size_t prefix_len = strlen(prefix); const size_t total_len = prefix_len + xattr->x_name_len + 1; if (buffer && total_len <= buffer_size) { - memcpy(buffer, handler->prefix, prefix_len); + memcpy(buffer, prefix, prefix_len); memcpy(buffer + prefix_len, xattr->x_name, xattr->x_name_len); buffer[prefix_len + xattr->x_name_len] = '\0'; |