Skip to contentSkip to conversation

master - thin: fix read size compare

PATCH Zdenek Kabelac 1 participant 1 message Feb 23, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f501f083bf1ea9f60a8b18aa9b5d59f3459ee4a6
Commit:        f501f083bf1ea9f60a8b18aa9b5d59f3459ee4a6
Parent:        05eb87ca2defb6e7e7bd9759bab566de7cb6e3f0
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Feb 23 12:11:15 2016 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Feb 23 12:22:18 2016 +0100

thin: fix read size compare

Fix the compare with 'unsigned' sizeof() and error read -1 result. So the read error is correctly recognized.

---
 WHATS_NEW                  |    1 +
 lib/activate/dev_manager.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
index f15d885..355712c 100644
@@ -1,5 +1,6 @@
 Version 2.02.144 - 
 =====================================
+  Fir read error detection when checking for uninitialized thin-pool header.
   Fix error path for internal error in lvmetad vg lookup code.
 
 Version 2.02.143 - 21st February 2016
lib/activate/dev_manager.c +1 -1
index 2826218..15d6bb9 100644
@@ -1841,7 +1841,7 @@ static int _pool_callback(struct dm_tree_node *node,
 			return 0;
 		}
 		/* let's assume there is no problem to read 64 bytes */
-		if (read(fd, buf, sizeof(buf)) < sizeof(buf)) {
+		if (read(fd, buf, sizeof(buf)) < (int)sizeof(buf)) {
 			log_sys_error("read", argv[args]);
 			if (close(fd))
 				log_sys_error("close", argv[args]);