fsck.gfs2: Handle gfs2_readi() errors in check_statfs()
PATCH 1/1 fsck.gfs2: Handle gfs2_readi() errors in check_statfs()
Discovered by static analysis with clang.
Related: rhbz#1394235
Signed-off-by Andrew Price <[email protected]>
--- gfs2/fsck/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
gfs2/fsck/main.c +6 -3
@@ -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 ;
Signature · 1 line
2.7.4
PATCH 1/1 fsck.gfs2: Handle gfs2_readi() errors in check_statfs()
----- Original Message -----
| Discovered by static analysis with clang. | | Related: rhbz#1394235 | Signed-off-by: Andrew Price <[email protected]> | ---
Looks good.
ACK
Bob Peterson
Red Hat File Systems