svn commit: r246349 - head/sys/fs/ext2fs

Pedro F. Giffuni pfg at FreeBSD.org
Tue Feb 5 03:13:06 UTC 2013


Author: pfg
Date: Tue Feb  5 03:13:05 2013
New Revision: 246349
URL: http://svnweb.freebsd.org/changeset/base/246349

Log:
  ext2fs: Correct off-by-one errors in FFTODT() and DDTOFT().
  
  Submitted by:	Christoph Mallon
  MFC after:	2 weeks

Modified:
  head/sys/fs/ext2fs/ext2_lookup.c

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_lookup.c	Tue Feb  5 03:08:56 2013	(r246348)
+++ head/sys/fs/ext2fs/ext2_lookup.c	Tue Feb  5 03:13:05 2013	(r246349)
@@ -89,7 +89,7 @@ static u_char ext2_ft_to_dt[] = {
 	DT_LNK,			/* EXT2_FT_SYMLINK */
 };
 #define	FTTODT(ft) \
-    ((ft) > nitems(ext2_ft_to_dt) ? DT_UNKNOWN : ext2_ft_to_dt[(ft)])
+    ((ft) < nitems(ext2_ft_to_dt) ? ext2_ft_to_dt[(ft)] : DT_UNKNOWN)
 
 static u_char dt_to_ext2_ft[] = {
 	EXT2_FT_UNKNOWN,	/* DT_UNKNOWN */
@@ -109,7 +109,7 @@ static u_char dt_to_ext2_ft[] = {
 	EXT2_FT_UNKNOWN,	/* DT_WHT */
 };
 #define	DTTOFT(dt) \
-    ((dt) > nitems(dt_to_ext2_ft) ? EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)])
+    ((dt) < nitems(dt_to_ext2_ft) ? dt_to_ext2_ft[(dt)] : EXT2_FT_UNKNOWN)
 
 static int	ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de,
 		    int entryoffsetinblock);


More information about the svn-src-all mailing list