struct image_type_params *tparams = NULL;
int pad_len = 0;
int dfd;
+ size_t map_len;
params.cmdname = *argv;
params.addr = 0;
}
params.file_size = sbuf.st_size;
- ptr = mmap(0, sbuf.st_size, PROT_READ|PROT_WRITE, MAP_SHARED, ifd, 0);
+ map_len = sbuf.st_size;
+ ptr = mmap(0, map_len, PROT_READ | PROT_WRITE, MAP_SHARED, ifd, 0);
if (ptr == MAP_FAILED) {
fprintf (stderr, "%s: Can't map %s: %s\n",
params.cmdname, params.imagefile, strerror(errno));
params.cmdname, tparams->name);
}
- (void) munmap((void *)ptr, sbuf.st_size);
+ (void)munmap((void *)ptr, map_len);
/* We're a bit of paranoid */
#if defined(_POSIX_SYNCHRONIZED_IO) && \