Hi,

When trying to get GPT working on the current OpenBSD snapshot I ran into a kernel crash. This is caused because the readgptlabel() passes an incorrect size to the last free() call in the function.

The size is stored in a variable 'gpsz'. However this variable is defined twice, in the function scope and in the for scope. This is obviously incorrect. The patch below fixes this.

Kind regards,

David


Index: sys/kern/subr_disk.c
===================================================================
RCS file: /cvs/src/sys/kern/subr_disk.c,v
retrieving revision 1.174
diff -u -p -r1.174 subr_disk.c
--- sys/kern/subr_disk.c        16 Dec 2014 18:30:04 -0000      1.174
+++ sys/kern/subr_disk.c        20 Dec 2014 13:14:41 -0000
@@ -650,7 +650,6 @@ readgptlabel(struct buf *bp, void (*stra
                uint32_t ghsize;
                uint32_t ghpartsize;
                uint32_t ghpartnum;
-               size_t gpsz;

                /* read header record */
                bp->b_blkno = DL_BLKTOSEC(lp, part_blkno) * DL_BLKSPERSEC(lp);

Reply via email to