From: Julia Lawall <julia@diku.dk>
To: miklos@szeredi.hu, fuse-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] fs/suse/inode.c: Add missing fuse_request_alloc
Date: Fri, 25 Jul 2008 21:33:25 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0807252131280.1602@ask.diku.dk> (raw)
From: Julia Lawall <julia@diku.dk>
The error handling code for the second call to fuse_request_alloc should
include freeing the result of the first one.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r@
expression x,E;
statement S;
position p1,p2,p3;
@@
(
if ((x = fuse_request_alloc@p1(...)) == NULL || ...) S
|
x = fuse_request_alloc@p1(...)
... when != x
if (x == NULL || ...) S
)
<...
if@p3 (...) { ... when != fuse_request_free(x)
return@p2 ...;
}
...>
(
return x;
|
return 0;
|
x = E
|
E = x
|
fuse_request_free(x)
)
@exists@
position r.p1,r.p2,r.p3;
expression x;
int ret != 0;
statement S;
@@
* x = fuse_request_alloc@p1(...)
<...
* if@p3 (...)
S
...>
* return@p2 \(NULL\|ret\);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
fs/fuse/inode.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 3141690..ae1d4fd 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -690,7 +690,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
if (is_bdev) {
fc->destroy_req = fuse_request_alloc();
if (!fc->destroy_req)
- goto err_put_root;
+ goto err_free_init_req;
}
mutex_lock(&fuse_mutex);
@@ -720,6 +720,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
err_unlock:
mutex_unlock(&fuse_mutex);
+ err_free_init_req:
fuse_request_free(init_req);
err_put_root:
dput(root_dentry);
next reply other threads:[~2008-07-25 19:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 19:33 Julia Lawall [this message]
2008-07-25 21:28 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0807252131280.1602@ask.diku.dk \
--to=julia@diku.dk \
--cc=fuse-devel@lists.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®