lkml.org 
[lkml]   [2018]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH][ocfs2-next] ocfs2: don't use a bool for error return from call to ocfs2_get_clusters
Date
From: Colin Ian King <colin.king@canonical.com>

Currently a bool is being used to get and check for a -ve error
return from the call to ocfs2_get_clusters but the check for ret < 0 is
never true for a bool. Fix this by using an int type for an error return
instead.

Detected by CoverityScan, CID#1463416 ("Operands don't affect result")

Fixes: ea6b711ecfb6 ("ocfs2-fall-back-to-buffer-io-when-append-dio-is-disabled-with-file-hole-existing-fix")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/ocfs2/aops.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 87562112cb5e..a3be523e001c 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -2432,10 +2432,12 @@ static bool ocfs2_range_has_holes(struct inode *inode, loff_t pos, size_t count)
clusters = ocfs2_clusters_for_bytes(sb, pos + count) - cpos;

while (clusters) {
- ret = ocfs2_get_clusters(inode, cpos, &phys_cpos, &extent_len,
+ int err;
+
+ err = ocfs2_get_clusters(inode, cpos, &phys_cpos, &extent_len,
&extent_flags);
- if (ret < 0) {
- mlog_errno(ret);
+ if (err < 0) {
+ mlog_errno(err);
goto out;
}

--
2.14.1
\
 
 \ /
  Last update: 2018-01-02 17:40    [W:0.034 / U:0.956 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site