Browse code

core: mem/qm - fixed pointer expressions in qm_check() debug function

Daniel-Constantin Mierla authored on 04/07/2017 06:40:29
Showing 1 changed files
... ...
@@ -728,18 +728,22 @@ void qm_check(struct qm_block* qm)
728 728
 			abort();
729 729
 		};
730 730
 #endif
731
-		if (f + sizeof(struct qm_frag) + f->size + sizeof(struct qm_frag_end) > qm->first_frag + qm->size) {
731
+		if ((char*)f + sizeof(struct qm_frag) + f->size
732
+				+ sizeof(struct qm_frag_end) > (char*)qm->first_frag + qm->size) {
732 733
 			LOG(L_CRIT, "BUG: qm_*: fragm. %p (address %p) "
733 734
 				"bad size: %lu (frag end: %p > end of block: %p)\n",
734
-				f, (char*)f + sizeof(struct qm_frag) + sizeof(struct qm_frag_end), f->size,
735
-				f + sizeof(struct qm_frag) + f->size, qm->first_frag + qm->size);
735
+				f, (char*)f + sizeof(struct qm_frag), f->size,
736
+				(char*)f + sizeof(struct qm_frag) + f->size
737
+					+ sizeof(struct qm_frag_end),
738
+				(char*)qm->first_frag + qm->size);
736 739
 			qm_status(qm);
737 740
 			abort();
738 741
 		}
739 742
 		/* check struct qm_frag_end */
740 743
 		if (FRAG_END(f)->size != f->size) {
741 744
 			LOG(L_CRIT, "BUG: qm_*: fragm. %p (address %p) "
742
-				"size in qm_frag and qm_frag_end does not match: frag->size=%lu, frag_end->size=%lu)\n",
745
+					"size in qm_frag and qm_frag_end does not match:"
746
+					" frag->size=%lu, frag_end->size=%lu)\n",
743 747
 				f, (char*)f + sizeof(struct qm_frag),
744 748
 				f->size, FRAG_END(f)->size);
745 749
 			qm_status(qm);