PR# 33260: [dM] kernel divide-by-zero for some broken disks

This commit is contained in:
jmcneill 2006-09-23 11:51:04 +00:00
parent 332a508d8a
commit 7ed78119d5
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_disk_mbr.c,v 1.18 2006/06/11 23:25:23 christos Exp $ */
/* $NetBSD: subr_disk_mbr.c,v 1.19 2006/09/23 11:51:04 jmcneill 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.18 2006/06/11 23:25:23 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.19 2006/09/23 11:51:04 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -107,6 +107,9 @@ read_sector(mbr_args_t *a, uint sector, int count)
struct buf *bp = a->bp;
int error;
if (a->lp->d_secpercyl == 0)
return EINVAL;
bp->b_blkno = sector;
bp->b_bcount = count * a->lp->d_secsize;
bp->b_flags = (bp->b_flags & ~(B_WRITE | B_DONE)) | B_READ;