summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-09-24 11:12:57 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-09-24 11:12:57 +0000
commit32a01671b3aa01e0ec24b8d19160e2b85a17bdb0 (patch)
tree4d45db04bd6ef2fce59be3d1a38b92917e87e2cc /sys/kern
parent073cbfbb4227b5e42bce9328a001c1165c0e35e9 (diff)
A couple of missing letoh32() conversions of GPT header fields in
gpt_chk_hdr() and gpt_chk_parts(). Spotted when investigating zeloff's GPT bug report.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_disk.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index 34f4739d189..59a85e1ce61 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.217 2015/09/15 05:35:42 yasuoka Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.218 2015/09/24 11:12:56 krw Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -631,7 +631,8 @@ gpt_chk_hdr(struct gpt_header *gh, struct disklabel *lp)
uint32_t ghsize, ghpartsize, ghpartspersec, ghpartnum;
gh->gh_csum = 0;
- gh->gh_csum = crc32(0, (unsigned char *)gh, gh->gh_size);
+ gh->gh_csum = crc32(0, (unsigned char *)gh,
+ letoh32(gh->gh_size));
if (orig_gh_csum != gh->gh_csum)
return (EINVAL);
@@ -693,7 +694,7 @@ gpt_chk_parts(struct gpt_header *gh, struct gpt_partition *gp)
{
u_int32_t checksum;
checksum = crc32(0, (unsigned char *)gp,
- gh->gh_part_num * gh->gh_part_size);
+ letoh32(gh->gh_part_num) * letoh32(gh->gh_part_size));
if (checksum != gh->gh_part_csum)
return (EINVAL);