[PATCH][ocfs2-next] ocfs2: don't use a bool for error return from call to ocfs2_get_clusters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux