bin/176953: [patch] fix Floating Exception in recoverdisk

r4721 at r4721 at
Thu Mar 14 10:00:01 UTC 2013

>Number:         176953
>Category:       bin
>Synopsis:       [patch] fix Floating Exception in recoverdisk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 14 10:00:00 UTC 2013
>Originator:     r4721 at
>Release:        9.1 stable amd64
the change to recoverdisk to optionally use stripesize causes Floating Exception.

pid 96884 (recoverdisk), uid 0: exited on signal 8

sectorsize and stripesize are both defined as u_int (32 bits), but the call to ioctl of DIOCGSTRIPESIZE returns a 64-bit number, overwriting the memory of sectorsize with 0, which is then used in a divison, causing a divide by zero error.

attached patch simply increases stripesize to 64 bits.


Patch attached with submission follows:

Index: sbin/recoverdisk/recoverdisk.c
--- sbin/recoverdisk/recoverdisk.c	(revision 247608)
+++ sbin/recoverdisk/recoverdisk.c	(working copy)
@@ -156,7 +153,7 @@
 	int error, state;
 	u_char *buf;
 	u_int sectorsize;
-	u_int stripesize;
+	u_long stripesize;
 	time_t t1, t2;
 	struct stat sb;
 	u_int n, snapshot = 60;


More information about the freebsd-bugs mailing list