diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 1594687582f0..9193dbea5728 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c @@ -34,6 +34,8 @@ static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off) lbound = 0; rbound = ih_entry_count(ih) - 1; + if (ih_item_len(ih) < (ih_entry_count(ih) * IH_SIZE)) + goto out; for (j = (rbound + lbound) / 2; lbound <= rbound; j = (rbound + lbound) / 2) { @@ -50,6 +52,7 @@ static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off) return NAME_FOUND; } +out: de->de_entry_num = lbound; return NAME_NOT_FOUND; }