From owner-freebsd-current Tue Oct 15 12:29:26 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E06A637B401 for ; Tue, 15 Oct 2002 12:29:25 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 8FDE343EAA for ; Tue, 15 Oct 2002 12:29:25 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 37080 invoked by uid 1000); 15 Oct 2002 19:29:26 -0000 Date: Tue, 15 Oct 2002 12:29:26 -0700 (PDT) From: Nate Lawson To: phk@freebsd.org Cc: current@freebsd.org Subject: GEOM/fdisk/USB drive problem Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG fdisk against my USB flash drive crashes with divide by zero. It turns out that get_params() starts with some default values (since there is no disklabel) and then runs some ioctls: DIOCGFWSECTORS and DIOCGFWHEADS. The problem is that fdisk checks the error from that ioctl and then happily uses whatever parameters it returned. My question is, should I add the error checking in userland (error == 0 && sector != 0) or in g_dev_ioctl? IMO, it should be in g_dev_ioctl so that we only have to validate the data in one place instead of multiple utilities (fdisk, disklabel, ...?) -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message