From mori@tri.asanuma.co.jp  Mon Mar 12 00:00:41 2001
Return-Path: <mori@tri.asanuma.co.jp>
Received: from shiva.tri.asanuma.co.jp (shiva.tri.asanuma.co.jp [210.160.188.2])
	by hub.freebsd.org (Postfix) with ESMTP id 2DF1937B718
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Mar 2001 00:00:39 -0800 (PST)
	(envelope-from mori@tri.asanuma.co.jp)
Received: from yashoda.tri.asanuma.co.jp (yashoda.tri.asanuma.co.jp [172.16.57.11])
	by shiva.tri.asanuma.co.jp (Postfix) with ESMTP id 2B7A5542B
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 12 Mar 2001 17:00:37 +0900 (JST)
Received: from localhost (kurishna.tri.asanuma.co.jp [2001:218:4dc:1:200:f8ff:fe02:ec60])
	by yashoda.tri.asanuma.co.jp (8.11.0/8.11.0) with ESMTP id f2C80a302039;
	Mon, 12 Mar 2001 17:00:36 +0900 (JST)
Message-Id: <20010312.170036.74756375.mori@tri.asanuma.co.jp>
Date: Mon, 12 Mar 2001 17:00:36 +0900 (JST)
From: MORI Kouji <mori@tri.asanuma.co.jp>
To: FreeBSD-gnats-submit@freebsd.org
Subject: quota(1) outputs wrong limits about nfs quota

>Number:         25724
>Category:       bin
>Synopsis:       quota(1) outputs wrong limits about NFS quota
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 12 00:10:01 PST 2001
>Closed-Date:    Sun Aug 10 09:56:21 PDT 2003
>Last-Modified:  Sun Aug 10 09:56:21 PDT 2003
>Originator:     Koji Mori
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Techinical Reserach Institute, Asanuma Corp., Takatsuki, Japan
>Environment:

	FreeBSD 4.2-stable (nfs client), NetBSD 1.5 (nfs server)

>Description:

	quota(1) has int overflow problem in getnfsquota().

	I set soft/hard limits to 5GB on remote system (NetBSD),
	and view quota on FreeBSD.
	I got follow output.  Soft/hard limits is too small.

     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
           /.u0 1980574* 805696  805696    none    9983       0       0        

	I expected follow output.

     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
           /.u0 1980574 5000000 5000000            9983       0       0        

>How-To-Repeat:

	Show big quota (ex. 5GB) on NFS mounted file system with quota.

>Fix:

	This patch is for src/usr.bin/quota/quota.c rev.1.11.2.1.

--- quota.c	2000/07/02 09:57:51	1.11.2.1
+++ quota.c	2001/03/12 02:59:15
@@ -641,13 +641,13 @@
 	case Q_OK:
 		gettimeofday(&tv, NULL);
 			/* blocks*/
-		dqp->dqb_bhardlimit =
+		dqp->dqb_bhardlimit = (u_quad_t)
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit *
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE;
-		dqp->dqb_bsoftlimit =
+		dqp->dqb_bsoftlimit = (u_quad_t)
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit *
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE;
-		dqp->dqb_curblocks =
+		dqp->dqb_curblocks = (u_quad_t)
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks *
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE;
 			/* inodes */

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: das 
State-Changed-When: Sun Aug 10 09:55:23 PDT 2003 
State-Changed-Why:  
Fixed in quota.c,v1.21 and 1.11.2.6 (STABLE). 

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