Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/dev/sun Pull up following revision(s) (requested by j...



details:   https://anonhg.NetBSD.org/src/rev/e35522f3e6bb
branches:  netbsd-9
changeset: 932294:e35522f3e6bb
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 04 13:58:17 2020 +0000

description:
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.

diffstat:

 sys/dev/sun/disksubr.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 675a74081c65 -r e35522f3e6bb sys/dev/sun/disksubr.c
--- a/sys/dev/sun/disksubr.c    Mon May 04 13:50:07 2020 +0000
+++ b/sys/dev/sun/disksubr.c    Mon May 04 13:58:17 2020 +0000
@@ -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 @@
                        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);



Home | Main Index | Thread Index | Old Index