On Thu, May 08, 2014 at 11:03:57AM +0800, Gui Hecheng wrote:
> Add sys chunk array and backup roots info if the new option '-f'
> if specified.
> This may be useful for debugging sys_chunk related issues.

Sounds useful. One comment below.

> +static void print_sys_chunk_array(struct btrfs_super_block *sb)
> +{
> +     struct extent_buffer *buf;
> +     struct btrfs_disk_key *disk_key;
> +     struct btrfs_chunk *chunk;
> +     struct btrfs_key key;
> +     u8 *ptr, *array_end;
> +     u32 num_stripes;
> +     u32 len = 0;
> +     int i = 0;
> +
> +     buf = malloc(sizeof(*buf) + sizeof(*sb));

Unchecked memory allocation

> +     write_extent_buffer(buf, sb, 0, sizeof(*sb));
> +     ptr = sb->sys_chunk_array;
> +     array_end = ptr + btrfs_super_sys_array_size(sb);
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to