From mark@genre121.com  Fri Aug  8 23:56:07 2008
Return-Path: <mark@genre121.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AB832106567C
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  8 Aug 2008 23:56:07 +0000 (UTC)
	(envelope-from mark@genre121.com)
Received: from mail.genre121.com (genre121.com [216.241.45.45])
	by mx1.freebsd.org (Postfix) with ESMTP id 8265E8FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  8 Aug 2008 23:56:07 +0000 (UTC)
	(envelope-from mark@genre121.com)
Received: from localhost (localhost [127.0.0.1])
	by mail.genre121.com (Postfix) with ESMTP id C699F5E0E
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  8 Aug 2008 17:42:52 -0600 (MDT)
Received: from mail.genre121.com ([127.0.0.1])
	by localhost (mail.genre121.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id cRvPjlEAgfXu for <FreeBSD-gnats-submit@freebsd.org>;
	Fri,  8 Aug 2008 17:42:44 -0600 (MDT)
Received: by mail.genre121.com (Postfix, from userid 1001)
	id C60C25E0D; Fri,  8 Aug 2008 17:42:43 -0600 (MDT)
Message-Id: <20080808234243.C60C25E0D@mail.genre121.com>
Date: Fri,  8 Aug 2008 17:42:43 -0600 (MDT)
From: Mark A <mark@genre121.com>
Reply-To: Mark A <mark@genre121.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: NANO_MEDIASIZE overflow
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         126386
>Category:       conf
>Synopsis:       [nanobsd] NANO_MEDIASIZE overflow
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    antoine
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 09 00:00:13 UTC 2008
>Closed-Date:    Sat Jan 10 09:41:28 UTC 2009
>Last-Modified:  Sat Jan 10 09:41:28 UTC 2009
>Originator:     Mark A
>Release:        FreeBSD 7.0-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD mail.genre121.com 7.0-RELEASE-p2 FreeBSD 7.0-RELEASE-p2 #0: Thu Jul 17 02:11:59 MDT 2008 mark@mail.genre121.com:/usr/obj/usr/src/sys/MAIL i386


        
>Description:
In /usr/src/tools/tools/nanobsd/FlashDevice.sub there are 2 lines
in question...

            NANO_MEDIASIZE=`expr 4097802240 / 512`
            NANO_MEDIASIZE=`expr 4224761856 / 512`

Those result with...

            expr 4097802240 / 512
            4194303

            expr 4224761856 / 512
            4194303

        
>How-To-Repeat:
    Include "FlashDevice Sandisk 4g" in your nanobsd configuration 
    file.
    
    Insert a few debugging print statements in nanobsd.sh where 
    NANO_MEDIASIZE is used. 

    When "/bin/sh nanobsd.sh -c nanobsd.conf" is run $NANO_MEDIASIZE 
    always prints 4194303.
    
        
>Fix:
    Use expr -e 

            expr -e 4097802240 / 512
            8003520

            expr -e 4224761856 / 512
            8251488
    
    The man page for expr also states that if EXPR_COMPAT is
    set then expr -e is used.

        
>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/126386: commit references a PR
Date: Tue, 12 Aug 2008 16:59:48 +0000 (UTC)

 antoine     2008-08-12 16:59:23 UTC
 
   FreeBSD src repository
 
   Modified files:
     tools/tools/nanobsd  FlashDevice.sub 
   Log:
   SVN rev 181631 on 2008-08-12 16:59:23Z by antoine
   
   Use expr -e instead of expr to compute NANO_MEDIASIZE for Flash devices
   larger than 2GB to prevent an overflow [1].
   Make case-insensitive comparison work for siliconsystems, soekris and
   transcend devices.
   
   PR:             conf/126386 [1]
   Submitted by:   Mark A [1]
   MFC after:      1 month
   
   Revision  Changes    Path
   1.9       +5 -5      src/tools/tools/nanobsd/FlashDevice.sub
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: antoine 
State-Changed-When: Tue Aug 12 17:06:11 UTC 2008 
State-Changed-Why:  
Patched in head. 


Responsible-Changed-From-To: freebsd-bugs->antoine 
Responsible-Changed-By: antoine 
Responsible-Changed-When: Tue Aug 12 17:06:11 UTC 2008 
Responsible-Changed-Why:  
MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126386 
State-Changed-From-To: patched->closed 
State-Changed-By: antoine 
State-Changed-When: Sat Jan 10 09:40:40 UTC 2009 
State-Changed-Why:  
Sam MFCed theses changes to stable/7. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=126386 
>Unformatted:
