make insert_data take an "unsigned long long" offset

When using genimage on a 32 bit host and trying to populate a ~8GiB
eMMC with a GPT image, we hit

INFO: hdimage(/dev/mmcblk0): determined size of block device /dev/mmcblk0 to be 7820083200
...
ERROR: hdimage(/dev/mmcblk0): seek /dev/mmcblk0: Invalid argument
ERROR: hdimage(/dev/mmcblk0): failed to write backup GPT table

This is because the "image->size - GPT_SECTORS*512" aka 7820066304
passed from hdimage_insert_gpt() becomes -769868288 when shoehorned
into a "signed long".

Make the offset parameter "unsigned long long" to match the protoype
of insert_image().

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
This commit is contained in:
Rasmus Villemoes 2023-02-08 13:38:35 +01:00
parent 2b9d87003b
commit 2bcf9b7471
2 changed files with 2 additions and 2 deletions

View File

@ -174,7 +174,7 @@ int insert_image(struct image *image, struct image *sub,
unsigned long long size, unsigned long long offset,
unsigned char byte);
int insert_data(struct image *image, const void *data, const char *outfile,
size_t size, long offset);
size_t size, unsigned long long offset);
int extend_file(struct image *image, size_t size);
int reload_partitions(struct image *image);
int parse_holes(struct image *image, cfg_t *cfg);

2
util.c
View File

@ -642,7 +642,7 @@ out:
}
int insert_data(struct image *image, const void *_data, const char *outfile,
size_t size, long offset)
size_t size, unsigned long long offset)
{
const char *data = _data;
int outf = -1;