diff mbox

btrfs: fix describe_relocation string pointer

Message ID 20180517132512.16377-1-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain May 17, 2018, 1:25 p.m. UTC
Looks like the original idea was to print the hex of the flags which
is not coded with their flag name. So use the current buf pointer bp
instead of buf.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/relocation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba May 18, 2018, 5:02 p.m. UTC | #1
On Thu, May 17, 2018 at 09:25:12PM +0800, Anand Jain wrote:
> Looks like the original idea was to print the hex of the flags which
> is not coded with their flag name. So use the current buf pointer bp
> instead of buf.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/relocation.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
> index 74656d79e511..879b76fa881a 100644
> --- a/fs/btrfs/relocation.c
> +++ b/fs/btrfs/relocation.c
> @@ -4344,7 +4344,7 @@ static void describe_relocation(struct btrfs_fs_info *fs_info,
>  		DESCRIBE_FLAG(RAID5,    "raid5");
>  		DESCRIBE_FLAG(RAID6,    "raid6");
>  		if (flags)
> -			snprintf(buf, buf - bp + sizeof(buf), "|0x%llx", flags);
> +			snprintf(bp, buf - bp + sizeof(buf), "|0x%llx", flags);

Good catch.

Reviewed-by: David Sterba <dsterba@suse.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 74656d79e511..879b76fa881a 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4344,7 +4344,7 @@  static void describe_relocation(struct btrfs_fs_info *fs_info,
 		DESCRIBE_FLAG(RAID5,    "raid5");
 		DESCRIBE_FLAG(RAID6,    "raid6");
 		if (flags)
-			snprintf(buf, buf - bp + sizeof(buf), "|0x%llx", flags);
+			snprintf(bp, buf - bp + sizeof(buf), "|0x%llx", flags);
 #undef DESCRIBE_FLAG
 	}