gfs2-utils: master - libgfs2: Fix pointer arithmetic in gfs2_quota_change_*

Andrew Price andyp at fedoraproject.org
Fri Sep 16 14:47:43 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=bda17315a280e3d8e6fc5136c331a55b1d4af43b
Commit:        bda17315a280e3d8e6fc5136c331a55b1d4af43b
Parent:        44fce5b34d7fad6e3a580fd8c917ce5a1d055c5f
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Fri Sep 16 15:30:21 2011 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Fri Sep 16 15:44:45 2011 +0100

libgfs2: Fix pointer arithmetic in gfs2_quota_change_*

Coverity discovered that a casting precedence error in the pointer
arithmetic of gfs2_quota_change_*. This patch fixes the calculations to
ensure the correct pointer types are used.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/libgfs2/ondisk.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index adbf4e9..73b2b0f 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -610,8 +610,8 @@ void gfs2_statfs_change_print(struct gfs2_statfs_change *sc)
 void gfs2_quota_change_in(struct gfs2_quota_change *qc,
 			  struct gfs2_buffer_head *bh)
 {
-	struct gfs2_quota_change *str = (struct gfs2_quota_change *)bh->b_data +
-		sizeof(struct gfs2_meta_header);
+	struct gfs2_quota_change *str = (struct gfs2_quota_change *)(bh->b_data +
+		sizeof(struct gfs2_meta_header));
 
 	CPIN_64(qc, str, qc_change);
 	CPIN_32(qc, str, qc_flags);
@@ -621,8 +621,8 @@ void gfs2_quota_change_in(struct gfs2_quota_change *qc,
 void gfs2_quota_change_out(struct gfs2_quota_change *qc,
 			   struct gfs2_buffer_head *bh)
 {
-	struct gfs2_quota_change *str = (struct gfs2_quota_change *)bh->b_data +
-		sizeof(struct gfs2_meta_header);
+	struct gfs2_quota_change *str = (struct gfs2_quota_change *)(bh->b_data +
+		sizeof(struct gfs2_meta_header));
 
 	CPOUT_64(qc, str, qc_change);
 	CPOUT_32(qc, str, qc_flags);


More information about the cluster-commits mailing list