cvs commit: src/sys/vfs/ufs ffs_alloc.c

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Aug 9 12:42:28 PDT 2004


dillon      2004/08/09 12:41:04 PDT

DragonFly src repository

  Modified files:
    sys/vfs/ufs          ffs_alloc.c 
  Log:
  ffs_dirpref() calculates dirsize = (fs->fs_avgfilesize * fs->fs_avgfpdir).
  However, these two paramters can be set by the sysop such that they easily
  overflow a 32 bit integer.  Use 64 bit arithmatic to prevent the overflow
  and special-case values > 0x7fffffff to simply set maxcontigdirs to 1 rather
  then waste time doing further 64 bit arithmatic.
  
  Note that NetBSD also changed 'cgsize' to a 64 bit integer, but fails to
  properly cast at least one of the arguments in both the dirsize and cgsize
  multiplication which means that the overflow bug in NetBSD has not actually
  been fixed.
  
  This patch does not change the cgsize calculation yet, it requires more
  review.
  
  Source: NetBSD ffs_alloc.c/1.74 from Barry Bouwsma of Tiengen.
  
  Revision  Changes    Path
  1.11      +21 -9     src/sys/vfs/ufs/ffs_alloc.c


http://www.dragonflybsd.org/cvsweb/src/sys/vfs/ufs/ffs_alloc.c.diff?r1=1.10&r2=1.11&f=u





More information about the Commits mailing list