From: Cengiz Can <cengiz@kernel.wtf>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Cengiz Can <cengiz@kernel.wtf>
Subject: [PATCH] fs: fuse: check return value of fuse_simple_request
Date: Mon, 20 Jan 2020 15:13:11 +0300 [thread overview]
Message-ID: <20200120121310.17601-1-cengiz@kernel.wtf> (raw)
In `fs/fuse/file.c` `fuse_simple_request` is used in multiple places,
with its return value properly checked for possible errors.
However the usage on `fuse_file_put` ignores its return value. And the
following `fuse_release_end` call used hard-coded error value of `0`.
This triggers a warning in static analyzers and such.
I've added a variable to capture `fuse_simple_request` result and passed
that to `fuse_release_end` instead.
Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
---
fs/fuse/file.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a63d779eac10..9914ee2af311 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -110,6 +110,7 @@ static void fuse_release_end(struct fuse_conn *fc, struct fuse_args *args,
static void fuse_file_put(struct fuse_file *ff, bool sync, bool isdir)
{
+ int err;
if (refcount_dec_and_test(&ff->count)) {
struct fuse_args *args = &ff->release_args->args;
@@ -117,8 +118,8 @@ static void fuse_file_put(struct fuse_file *ff, bool sync, bool isdir)
/* Do nothing when client does not implement 'open' */
fuse_release_end(ff->fc, args, 0);
} else if (sync) {
- fuse_simple_request(ff->fc, args);
- fuse_release_end(ff->fc, args, 0);
+ err = fuse_simple_request(ff->fc, args);
+ fuse_release_end(ff->fc, args, err);
} else {
args->end = fuse_release_end;
if (fuse_simple_background(ff->fc, args,
--
2.25.0
next reply other threads:[~2020-01-20 12:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 12:13 Cengiz Can [this message]
2020-01-20 13:39 ` [PATCH] fs: fuse: check return value of fuse_simple_request Miklos Szeredi
2020-01-22 12:56 ` Cengiz Can
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=20200120121310.17601-1-cengiz@kernel.wtf \
--to=cengiz@kernel.wtf \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).