summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2007-07-11 04:50:43 +0000
committermiod <miod@openbsd.org>2007-07-11 04:50:43 +0000
commit3d70cd2b74eda86461921720b25e55adba6ea55e (patch)
tree440d9bb4b5f0581cabf5cffe79f9beb1f07ef2a6
parentdo not put mt/eject onto small media; ok krw (diff)
downloadwireguard-openbsd-3d70cd2b74eda86461921720b25e55adba6ea55e.tar.xz
wireguard-openbsd-3d70cd2b74eda86461921720b25e55adba6ea55e.zip
Do not divide by zero in DISKLABELV1_FFS_FSIZE if the argument value is bogus;
ok otto@ millert@ krw@
-rw-r--r--sys/sys/disklabel.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h
index a450b88bc82..58429e75c29 100644
--- a/sys/sys/disklabel.h
+++ b/sys/sys/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.38 2007/06/20 18:15:47 deraadt Exp $ */
+/* $OpenBSD: disklabel.h,v 1.39 2007/07/11 04:50:43 miod Exp $ */
/* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */
/*
@@ -203,7 +203,7 @@ struct __partitionv0 { /* the partition table */
#define DISKLABELV1_FFS_BSIZE(i) ((i) == 0 ? 0 : (1 << (((i) >> 3) + 12)))
#define DISKLABELV1_FFS_FRAG(i) ((i) == 0 ? 0 : (1 << (((i) & 0x07) - 1)))
-#define DISKLABELV1_FFS_FSIZE(i) ((i) == 0 ? 0 : \
+#define DISKLABELV1_FFS_FSIZE(i) (DISKLABELV1_FFS_FRAG(i) == 0 ? 0 : \
(DISKLABELV1_FFS_BSIZE(i) / DISKLABELV1_FFS_FRAG(i)))
#define DL_GETPSIZE(p) (((u_int64_t)(p)->p_sizeh << 32) + (p)->p_size)