Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
e2image: Add an assertion/sanity check in initialize_qcow2_image()
[tools/e2fsprogs.git]
/
misc
/
e2image.c
diff --git
a/misc/e2image.c
b/misc/e2image.c
index
99a2ed9
..
d52accf
100644
(file)
--- a/
misc/e2image.c
+++ b/
misc/e2image.c
@@
-874,8
+874,8
@@
static int init_refcount(struct ext2_qcow2_image *img, blk64_t table_offset)
return ret;
}
return ret;
}
-static
in
t initialize_qcow2_image(int fd, ext2_filsys fs,
- struct ext2_qcow2_image *image)
+static
errcode_
t initialize_qcow2_image(int fd, ext2_filsys fs,
+
struct ext2_qcow2_image *image)
{
struct ext2_qcow2_hdr *header;
blk64_t total_size, offset;
{
struct ext2_qcow2_hdr *header;
blk64_t total_size, offset;
@@
-883,6
+883,9
@@
static int initialize_qcow2_image(int fd, ext2_filsys fs,
int cluster_bits = get_bits_from_size(fs->blocksize);
struct ext2_super_block *sb = fs->super;
int cluster_bits = get_bits_from_size(fs->blocksize);
struct ext2_super_block *sb = fs->super;
+ if (fs->blocksize < 1024)
+ return EINVAL; /* Can never happen, but just in case... */
+
/* Allocate header */
ret = ext2fs_get_memzero(sizeof(struct ext2_qcow2_hdr), &header);
if (ret)
/* Allocate header */
ret = ext2fs_get_memzero(sizeof(struct ext2_qcow2_hdr), &header);
if (ret)