cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] fsck.gfs2: Handle gfs2_readi() errors in check_statfs()
@ 2016-11-11 13:29 Andrew Price
  2016-11-11 14:04 ` Bob Peterson
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Price @ 2016-11-11 13:29 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Discovered by static analysis with clang.

Related: rhbz#1394235
Signed-off-by: Andrew Price <anprice@redhat.com>
---
 gfs2/fsck/main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index c5967bc..51f3e03 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -170,9 +170,12 @@ static int check_statfs(struct gfs2_sbd *sdp)
 	/* Read the current statfs values */
 	count = gfs2_readi(sdp->md.statfs, buf, 0,
 			   sdp->md.statfs->i_di.di_size);
-	if (count == sizeof(struct gfs2_statfs_change))
-		gfs2_statfs_change_in(&sc, buf);
-
+	if (count != sizeof(struct gfs2_statfs_change)) {
+		log_err(_("Failed to read statfs values (%d of %"PRIu64" read)\n"),
+		        count, (uint64_t)sdp->md.statfs->i_di.di_size);
+		return FSCK_ERROR;
+	}
+	gfs2_statfs_change_in(&sc, buf);
 	/* Calculate the real values from the rgrp information */
 	sdp->blks_total = 0;
 	sdp->blks_alloced = 0;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [PATCH] fsck.gfs2: Handle gfs2_readi() errors in check_statfs()
  2016-11-11 13:29 [Cluster-devel] [PATCH] fsck.gfs2: Handle gfs2_readi() errors in check_statfs() Andrew Price
@ 2016-11-11 14:04 ` Bob Peterson
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Peterson @ 2016-11-11 14:04 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- Original Message -----
| Discovered by static analysis with clang.
| 
| Related: rhbz#1394235
| Signed-off-by: Andrew Price <anprice@redhat.com>
| ---

Looks good.

ACK

Bob Peterson
Red Hat File Systems



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-11 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-11 13:29 [Cluster-devel] [PATCH] fsck.gfs2: Handle gfs2_readi() errors in check_statfs() Andrew Price
2016-11-11 14:04 ` Bob Peterson

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).