Re: [PATCH 2/4 v3] e2image: Add support for qcow2 format

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

 



On May 18, 2011, at 05:36, Lukas Czerner wrote:
> diff --git a/lib/ext2fs/qcow2.c b/lib/ext2fs/qcow2.c
> new file mode 100644
> index 0000000..7de72ed
> --- /dev/null
> +++ b/lib/ext2fs/qcow2.c

> +int qcow2_write_raw_image(int qcow2_fd, int raw_fd,
> +			      struct ext2_qcow2_hdr *hdr)
> +{
> +	struct ext2_qcow2_image img;
> +	errcode_t ret = 0;
> +	unsigned int l1_index, l2_index;
> +	ext2_off64_t offset;
> +	blk64_t *l1_table, *l2_table;
> +	void *copy_buf = NULL;
> +	size_t size;
> +
> +	if (hdr->crypt_method)
> +		return -QCOW_ENCRYPTED;

Good.

> +	for (l1_index = 0; l1_index < img.l1_size; l1_index++) {
> +		ext2_off64_t off_out;
> +
> +		offset = ext2fs_be64_to_cpu(l1_table[l1_index]) &
> +			 ~QCOW_OFLAG_COPIED;
> +
> +		if ((offset > img.image_size) ||
> +		    (offset <= 0))
> +			continue;

Should this be considered an error, instead of just silently continuing?  At a minimum it should print an error to the user and return a non-zero value on exit, but I'm not sure whether it should abort because the user may care more about extracting _some_ data from the image instead of little or none.

Cheers, Andreas





--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux