diff --git a/sys/kern/subr_disk_mbr.c b/sys/kern/subr_disk_mbr.c index 24b7ae5b8897..884a0f032be0 100644 --- a/sys/kern/subr_disk_mbr.c +++ b/sys/kern/subr_disk_mbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_disk_mbr.c,v 1.53 2019/11/07 18:30:27 kamil Exp $ */ +/* $NetBSD: subr_disk_mbr.c,v 1.54 2019/11/07 18:35:41 kamil Exp $ */ /* * Copyright (c) 1982, 1986, 1988 Regents of the University of California. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.53 2019/11/07 18:30:27 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.54 2019/11/07 18:35:41 kamil Exp $"); #include #include @@ -571,11 +571,8 @@ look_netbsd_part(mbr_args_t *a, mbr_partition_t *dp, int slot, uint ext_base) static bool check_label_magic(const struct disklabel *dlp, uint32_t diskmagic) { - - return memcmp((const char *)dlp + offsetof(struct disklabel, d_magic), - &diskmagic, sizeof(diskmagic)) == 0 && - memcmp((const char *)dlp + offsetof(struct disklabel, d_magic2), - &diskmagic, sizeof(diskmagic)) == 0; + return memcmp(&dlp->d_magic, &diskmagic, sizeof(diskmagic)) == 0 && + memcmp(&dlp->d_magic2, &diskmagic, sizeof(diskmagic)) == 0; } #ifdef DISKLABEL_EI