From 51f9e0937ba2666b7fa489768b038cf26da8cc47 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sun, 1 Oct 2023 14:24:04 +0200 Subject: [PATCH] libblkid: (probe) remove chunking from blkid_probe_get_idmag() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit blkid_probe_get_buffer is doing the same thing internally now. Signed-off-by: Thomas Weißschuh --- libblkid/src/probe.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index 552bed22c0..19b80ec6eb 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -1280,21 +1280,19 @@ int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id, kboff = ((mag->zonenum * pr->zone_size) >> 10) + mag->kboff_inzone; if (kboff >= 0) - off = hint_offset + ((kboff + (mag->sboff >> 10)) << 10); + off = hint_offset + (kboff << 10) + mag->sboff; else - off = pr->size - (-kboff << 10); - buf = blkid_probe_get_buffer(pr, off, 1024); + off = pr->size - (-kboff << 10) + mag->sboff; + buf = blkid_probe_get_buffer(pr, off, mag->len); if (!buf && errno) return -errno; - if (buf && !memcmp(mag->magic, - buf + (mag->sboff & 0x3ff), mag->len)) { - + if (buf && !memcmp(mag->magic, buf, mag->len)) { DBG(LOWPROBE, ul_debug("\tmagic sboff=%u, kboff=%ld", mag->sboff, kboff)); if (offset) - *offset = off + (mag->sboff & 0x3ff); + *offset = off; if (res) *res = mag; return BLKID_PROBE_OK; -- 2.47.3