Module Name: src
Committed By: martin
Date: Mon May 4 13:58:17 UTC 2020
Modified Files:
src/sys/dev/sun [netbsd-9]: disksubr.c
Log Message:
Pull up following revision(s) (requested by jdc in ticket #886):
sys/dev/sun/disksubr.c: revision 1.17
If the sector size is 0, return early in readdisklabel().
Prevents a panic trying to use a 0-sized buffer, which can happen if we run
(e.g.) `scsictl /dev/cd0c identify` with no medium in the CD drive.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/dev/sun/disksubr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/sun/disksubr.c
diff -u src/sys/dev/sun/disksubr.c:1.16 src/sys/dev/sun/disksubr.c:1.16.4.1
--- src/sys/dev/sun/disksubr.c:1.16 Wed Apr 3 22:10:52 2019
+++ src/sys/dev/sun/disksubr.c Mon May 4 13:58:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.16 2019/04/03 22:10:52 christos Exp $ */
+/* $NetBSD: disksubr.c,v 1.16.4.1 2020/05/04 13:58:17 martin Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.16 2019/04/03 22:10:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.16.4.1 2020/05/04 13:58:17 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -104,6 +104,8 @@ readdisklabel(dev_t dev, void (*strat)(s
lp->d_partitions[RAW_PART].p_size = 0x1fffffff;
lp->d_partitions[RAW_PART].p_offset = 0;
}
+ if (lp->d_secsize == 0)
+ return ("sector size 0");
/* obtain buffer to probe drive with */
bp = geteblk((int)lp->d_secsize);