From: Colin Ian King <colin.k...@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.k...@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

Reply via email to