Change the 'sz' variable in bounds_check_* to int64_t to avoid overflows

when a very large blocknumber is passed in.
This commit is contained in:
fvdl 2005-02-08 08:56:21 +00:00
parent 44315eaaa0
commit af5309b07c
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_disk.c,v 1.66 2005/02/06 23:57:29 christos Exp $ */
/* $NetBSD: subr_disk.c,v 1.67 2005/02/08 08:56:21 fvdl Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc.
@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.66 2005/02/06 23:57:29 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.67 2005/02/08 08:56:21 fvdl Exp $");
#include "opt_compat_netbsd.h"
@ -551,7 +551,7 @@ bufq_free(struct bufq_state *bufq)
int
bounds_check_with_mediasize(struct buf *bp, int secsize, u_int64_t mediasize)
{
int sz;
int64_t sz;
sz = howmany(bp->b_bcount, secsize);

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_disk_mbr.c,v 1.4 2003/10/08 04:25:46 lukem Exp $ */
/* $NetBSD: subr_disk_mbr.c,v 1.5 2005/02/08 08:58:19 fvdl Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.4 2003/10/08 04:25:46 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.5 2005/02/08 08:58:19 fvdl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -545,7 +545,7 @@ bounds_check_with_label(dk, bp, wlabel)
struct disklabel *lp = dk->dk_label;
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR;
int sz;
int64_t sz;
sz = howmany(bp->b_bcount, lp->d_secsize);