summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2013-02-05 03:13:05 +0000
committerpfg <pfg@FreeBSD.org>2013-02-05 03:13:05 +0000
commit28dd7f0e2d52783a84b0a2e72365a2ff34d54a41 (patch)
tree56c820db83ea65d61b5dfeef8dcb066b1cb6bd85
parentc181635a65f2aac53f06c8553fa9b67317362cf0 (diff)
downloadFreeBSD-src-28dd7f0e2d52783a84b0a2e72365a2ff34d54a41.zip
FreeBSD-src-28dd7f0e2d52783a84b0a2e72365a2ff34d54a41.tar.gz
ext2fs: Correct off-by-one errors in FFTODT() and DDTOFT().
Submitted by: Christoph Mallon MFC after: 2 weeks
-rw-r--r--sys/fs/ext2fs/ext2_lookup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c
index edd5704..441e9a6 100644
--- a/sys/fs/ext2fs/ext2_lookup.c
+++ b/sys/fs/ext2fs/ext2_lookup.c
@@ -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);
OpenPOWER on IntegriCloud