Subject: bin/2462: quot can't report large partition
To: None <gnats-bugs@NetBSD.ORG>
From: Tatoku Ogaito <tacha@tera.fukui-med.ac.jp>
List: netbsd-bugs
Date: 05/24/1996 11:20:51
>Number:         2462
>Category:       bin
>Synopsis:       quot can't report large partition
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 23 22:35:04 1996
>Last-Modified:
>Originator:     Tatoku Ogaito
>Organization:
Tatoku Ogaito		| Email: tacha@tera.fukui-med.ac.jp
Department of Physics   | Fax:   +81 776-61-8141
Fukui Medical School  	| Tel:   +81 776-61-3111 ext 2446
>Release:        NetBSD-current as of May 7
>Environment:
System: NetBSD tera.fukui-med.ac.jp 1.1B NetBSD 1.1B (TERA) #8: Fri May 10 15:49:09 JST 1996 tacha@tera.fukui-med.ac.jp:/usr/current/src/sys/arch/i386/compile/TERA i386


>Description:
	quot uses ino_to_fsba macro, which is defined in <ffs/ufs/fs.h> 
as return type daddr_t, in function get_inode.  When the return value of
the macro becomes larger than 4194304, at least in my case, the second
argment of lseek causes overflow and exit with the message
read inodes: Undefined error: 0.

>How-To-Repeat:
	quot -fvk large_partition_device
>Fix:
*** /usr/current/src/usr.sbin/quot/quot.c	Tue Dec 12 05:58:42 1995
--- ./quot.c	Fri May 24 11:14:52 1996
***************
*** 94,100 ****
  			exit(1);
  		}
  		last = (ino / INOCNT(super)) * INOCNT(super);
! 		if (lseek(fd,ino_to_fsba(super,last) << super->fs_fshift,0) < 0
  		    || read(fd,ip,INOSZ(super)) != INOSZ(super)) {
  			perror("read inodes");
  			exit(1);
--- 94,100 ----
  			exit(1);
  		}
  		last = (ino / INOCNT(super)) * INOCNT(super);
! 		if (lseek(fd,((off_t)ino_to_fsba(super,last)) << super->fs_fshift,0) < 0
  		    || read(fd,ip,INOSZ(super)) != INOSZ(super)) {
  			perror("read inodes");
  			exit(1);
>Audit-Trail:
>Unformatted: