Deleted Added
full compact
37c37
< __FBSDID("$FreeBSD: stable/10/sys/geom/uncompress/g_uncompress.c 283900 2015-06-02 02:05:32Z ae $");
---
> __FBSDID("$FreeBSD: stable/10/sys/geom/uncompress/g_uncompress.c 266220 2014-05-16 14:28:55Z loos $");
467,468c467
< uint64_t *offsets;
< uint32_t i, r, total, total_offsets, type;
---
> uint32_t i, total_offsets, type;
503,504c502,503
< total = roundup(sizeof(struct cloop_header), pp->sectorsize);
< buf = g_read_data(cp, 0, total, NULL);
---
> i = roundup(sizeof(struct cloop_header), pp->sectorsize);
> buf = g_read_data(cp, 0, i, NULL);
561c560
< g_free(buf);
---
> free(buf, M_GEOM);
563,565c562
< sc->offsets = malloc(total_offsets * sizeof(uint64_t),
< M_GEOM_UNCOMPRESS, M_WAITOK | M_ZERO);
< total = roundup((sizeof(struct cloop_header) +
---
> i = roundup((sizeof(struct cloop_header) +
567,581c564,571
< #define RSZ ((total - r) > MAXPHYS ? MAXPHYS: (total - r))
< for (r = 0, i = 0; r < total; r += MAXPHYS) {
< buf = g_read_data(cp, r, RSZ, &error);
< if (buf == NULL) {
< free(sc->offsets, M_GEOM_UNCOMPRESS);
< goto err;
< }
< offsets = (uint64_t *)buf;
< if (r == 0)
< offsets +=
< sizeof(struct cloop_header) / sizeof(uint64_t);
< for (; i < total_offsets && offsets < (uint64_t *)(buf + RSZ);
< i++, offsets++)
< sc->offsets[i] = be64toh(*offsets);
< g_free(buf);
---
> buf = g_read_data(cp, 0, i, NULL);
> if (buf == NULL)
> goto err;
> sc->offsets = malloc(total_offsets * sizeof(uint64_t),
> M_GEOM_UNCOMPRESS, M_WAITOK);
> for (i = 0; i <= total_offsets; i++) {
> sc->offsets[i] = be64toh(((uint64_t *)
> (buf+sizeof(struct cloop_header)))[i]);
583,584c573
< #undef RSZ
< buf = NULL;
---
> free(buf, M_GEOM);
632c621
< g_free(buf);
---
> free(buf, M_GEOM);