summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/orangefs/dir.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/orangefs/dir.c b/fs/orangefs/dir.c
index cac601498925..d327cbd17756 100644
--- a/fs/orangefs/dir.c
+++ b/fs/orangefs/dir.c
@@ -135,9 +135,12 @@ static int parse_readdir(struct orangefs_dir *od,
count = 1;
part = od->part;
- while (part && part->next) {
- part = part->next;
+ while (part) {
count++;
+ if (part->next)
+ part = part->next;
+ else
+ break;
}
new = (void *)op->downcall.trailer_buf;