Re: [PATCH 1/2 v3] btrfs: label should not contain return char

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 22, 2014 at 06:41:11PM +0800, Anand Jain wrote:
> @@ -385,7 +392,8 @@ static ssize_t btrfs_label_store(struct kobject *kobj,
>  		return PTR_ERR(trans);
>  
>  	spin_lock(&root->fs_info->super_lock);
> -	strcpy(fs_info->super_copy->label, buf);
> +	strncpy(fs_info->super_copy->label, buf, p_len);
> +	memset(fs_info->super_copy->label + p_len, '\0', 1);

This looks strange, memset of length 1?

Anyway, I think the label buffer should be zeroed at the empty space, so
the idea is

	memset(fs_info->super_copy->label, 0, BTRFS_LABEL_SIZE):
	memcpy(fs_info->super_copy->label, buf, p_len);

Not super efficient, but works.

>  	spin_unlock(&root->fs_info->super_lock);
>  	ret = btrfs_commit_transaction(trans, root);
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux