diff options
author | David Howells <dhowells@redhat.com> | 2010-04-21 07:01:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-04-21 15:27:43 -0400 |
commit | 083fd8b21a13742b37ab347089c73f895a896672 (patch) | |
tree | 175030e7b74d83d768529b9d910b852f097a71c7 /fs | |
parent | 05ce7bfe547c9fa967d9cab6c37867a9cb6fb3fa (diff) |
AFS: Don't pass error value to page_cache_release() in error handling
In the error handling in afs_mntpt_do_automount(), we pass an error
pointer to page_cache_release() if read_mapping_page() failed. Instead,
we should extend the gotos around the error handling we don't need.
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/afs/mntpt.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index 5e813a816ce4..b3feddc4f7d6 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c | |||
@@ -138,9 +138,9 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
138 | { | 138 | { |
139 | struct afs_super_info *super; | 139 | struct afs_super_info *super; |
140 | struct vfsmount *mnt; | 140 | struct vfsmount *mnt; |
141 | struct page *page = NULL; | 141 | struct page *page; |
142 | size_t size; | 142 | size_t size; |
143 | char *buf, *devname = NULL, *options = NULL; | 143 | char *buf, *devname, *options; |
144 | int ret; | 144 | int ret; |
145 | 145 | ||
146 | _enter("{%s}", mntpt->d_name.name); | 146 | _enter("{%s}", mntpt->d_name.name); |
@@ -150,22 +150,22 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
150 | ret = -EINVAL; | 150 | ret = -EINVAL; |
151 | size = mntpt->d_inode->i_size; | 151 | size = mntpt->d_inode->i_size; |
152 | if (size > PAGE_SIZE - 1) | 152 | if (size > PAGE_SIZE - 1) |
153 | goto error; | 153 | goto error_no_devname; |
154 | 154 | ||
155 | ret = -ENOMEM; | 155 | ret = -ENOMEM; |
156 | devname = (char *) get_zeroed_page(GFP_KERNEL); | 156 | devname = (char *) get_zeroed_page(GFP_KERNEL); |
157 | if (!devname) | 157 | if (!devname) |
158 | goto error; | 158 | goto error_no_devname; |
159 | 159 | ||
160 | options = (char *) get_zeroed_page(GFP_KERNEL); | 160 | options = (char *) get_zeroed_page(GFP_KERNEL); |
161 | if (!options) | 161 | if (!options) |
162 | goto error; | 162 | goto error_no_options; |
163 | 163 | ||
164 | /* read the contents of the AFS special symlink */ | 164 | /* read the contents of the AFS special symlink */ |
165 | page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); | 165 | page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); |
166 | if (IS_ERR(page)) { | 166 | if (IS_ERR(page)) { |
167 | ret = PTR_ERR(page); | 167 | ret = PTR_ERR(page); |
168 | goto error; | 168 | goto error_no_page; |
169 | } | 169 | } |
170 | 170 | ||
171 | ret = -EIO; | 171 | ret = -EIO; |
@@ -196,12 +196,12 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
196 | return mnt; | 196 | return mnt; |
197 | 197 | ||
198 | error: | 198 | error: |
199 | if (page) | 199 | page_cache_release(page); |
200 | page_cache_release(page); | 200 | error_no_page: |
201 | if (devname) | 201 | free_page((unsigned long) options); |
202 | free_page((unsigned long) devname); | 202 | error_no_options: |
203 | if (options) | 203 | free_page((unsigned long) devname); |
204 | free_page((unsigned long) options); | 204 | error_no_devname: |
205 | _leave(" = %d", ret); | 205 | _leave(" = %d", ret); |
206 | return ERR_PTR(ret); | 206 | return ERR_PTR(ret); |
207 | } | 207 | } |