diff options
Diffstat (limited to 'fs/9p/fid.c')
-rw-r--r-- | fs/9p/fid.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index b364da70ff2..dfebdbe7440 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -175,7 +175,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) | |||
175 | if (!wnames) | 175 | if (!wnames) |
176 | return ERR_PTR(-ENOMEM); | 176 | return ERR_PTR(-ENOMEM); |
177 | 177 | ||
178 | for (d = dentry, i = n; i >= 0; i--, d = d->d_parent) | 178 | for (d = dentry, i = (n-1); i >= 0; i--, d = d->d_parent) |
179 | wnames[i] = (char *) d->d_name.name; | 179 | wnames[i] = (char *) d->d_name.name; |
180 | 180 | ||
181 | clone = 1; | 181 | clone = 1; |
@@ -183,7 +183,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) | |||
183 | while (i < n) { | 183 | while (i < n) { |
184 | l = min(n - i, P9_MAXWELEM); | 184 | l = min(n - i, P9_MAXWELEM); |
185 | fid = p9_client_walk(fid, l, &wnames[i], clone); | 185 | fid = p9_client_walk(fid, l, &wnames[i], clone); |
186 | if (!fid) { | 186 | if (IS_ERR(fid)) { |
187 | kfree(wnames); | 187 | kfree(wnames); |
188 | return fid; | 188 | return fid; |
189 | } | 189 | } |