NetBSD Problem Report #534

From gnats  Wed Oct 26 12:06:26 1994
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id MAA22220 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Wed, 26 Oct 1994 12:06:25 -0700
Message-Id: <9410261847.AA18122@hdssun1.hds.com>
Date: Wed, 26 Oct 94 14:47:22 EDT
From: mikeh@hds.com
Reply-To: mikeh@hds.com
To: gnats-bugs@NetBSD.ORG
Subject: Bug in MSDOSFS
X-Send-Pr-Version: 3.2

>Number:         534
>Category:       kern
>Synopsis:       MSDOSFS: EOF flag not properly set in msdosfs_readdir().
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 26 12:20:03 +0000 1994
>Closed-Date:    Wed Oct 26 20:52:35 +0000 1994
>Last-Modified:  
>Originator:     Mike Hartman
>Release:        current
>Organization:
Human Designed Systems, Inc.
>Environment:

System: SunOS hdssun1 4.1.3 1 sun4m
Architecture: sun4

>Description:
There are two instances where the EOF flag is not properly set.  In the first
instance, the uio offset is at or past the EOF, but the EOF flag is not set.
In the second instance, the math to determine EOF is missing parenthesis to
properly order the expression evaluation.

>How-To-Repeat:

>Fix:
*** src/src/sys/msdosfs/msdosfs_vnops.c	Wed Oct 26 12:44:37 1994
--- src/src/sys/msdosfs/msdosfs_vnops.c	Wed Oct 26 14:19:45 1994
***************
*** 1499,1506 ****
  		on = (uio->uio_offset - bias) & pmp->pm_crbomask;
  		n = min((u_long) (pmp->pm_bpcluster - on), uio->uio_resid);
  		diff = dep->de_FileSize - (uio->uio_offset - bias);
! 		if (diff <= 0)
  			return 0;
  		if (diff < n)
  			n = diff;
  		error = pcbmap(dep, lbn, &bn, &cn);
--- 1499,1508 ----
  		on = (uio->uio_offset - bias) & pmp->pm_crbomask;
  		n = min((u_long) (pmp->pm_bpcluster - on), uio->uio_resid);
  		diff = dep->de_FileSize - (uio->uio_offset - bias);
! 		if (diff <= 0) {
! 			*ap->a_eofflag = 1;
  			return 0;
+ 		}
  		if (diff < n)
  			n = diff;
  		error = pcbmap(dep, lbn, &bn, &cn);
***************
*** 1638,1648 ****
  	uio->uio_resid += lost;

  	/*
! 	 * I don't know why we bother setting this eofflag, getdirentries()
! 	 * in vfs_syscalls.c doesn't bother to look at it when we return.
! 	 * (because NFS uses it in nfs_serv.c -- JMP)
  	 */
! 	if (dep->de_FileSize - uio->uio_offset - bias <= 0)
  		*ap->a_eofflag = 1;
  	else
  		*ap->a_eofflag = 0;
--- 1640,1648 ----
  	uio->uio_resid += lost;

  	/*
! 	 * Set the eofflag.
  	 */
! 	if (dep->de_FileSize - (uio->uio_offset - bias) <= 0)
  		*ap->a_eofflag = 1;
  	else
  		*ap->a_eofflag = 0;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Wed Oct 26 13:52:35 PDT 1994 
State-Changed-Why:  
Already fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.