From ed9361379abe225e173a21ef742e57b79340c9c2 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 9 Aug 2008 19:20:07 +0000 Subject: [PATCH] Prevent integer overflow in DL_BLKTOSEC(). ok krw@ --- sys/sys/disklabel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index a6fbc916ed1..a26415f7cdb 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.42 2008/08/08 23:49:53 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.43 2008/08/09 19:20:07 kettenis Exp $ */ /* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */ /* @@ -229,7 +229,7 @@ struct __partitionv0 { /* the partition table */ #define DL_BLKSPERSEC(d) ((d)->d_secsize / DEV_BSIZE) #define DL_SECTOBLK(d, n) ((n) * DL_BLKSPERSEC(d)) -#define DL_BLKTOSEC(d, n) (((n) * DEV_BSIZE) / (d)->d_secsize) +#define DL_BLKTOSEC(d, n) ((n) / DL_BLKSPERSEC(d)) #define DL_BLKOFFSET(d, n) (((n) * DEV_BSIZE) % (d)->d_secsize) /* d_type values: */ -- 2.20.1