fix(lib/realm): fix MISRA C:2012 Rule 10.1,4 in buffer.c
Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
Change-Id: I6b3539ed7053b908667231ec41cd984ef2c66583
diff --git a/lib/realm/src/buffer.c b/lib/realm/src/buffer.c
index f5aa1d8..dddba0e 100644
--- a/lib/realm/src/buffer.c
+++ b/lib/realm/src/buffer.c
@@ -74,7 +74,7 @@
{
assert(slot < NR_CPU_SLOTS);
- return (uintptr_t)(SLOT_VIRT + (GRANULE_SIZE * slot));
+ return (uintptr_t)(SLOT_VIRT + (GRANULE_SIZE * (unsigned int)slot));
}
static inline struct xlat_ctx *get_slot_buf_xlat_ctx(void)
@@ -178,9 +178,7 @@
*/
void assert_cpu_slots_empty(void)
{
- unsigned int i;
-
- for (i = 0; i < NR_CPU_SLOTS; i++) {
+ for (unsigned int i = 0U; i < (unsigned int)NR_CPU_SLOTS; i++) {
assert(slot_to_descriptor(i) == TRANSIENT_DESC);
}
}
@@ -257,9 +255,9 @@
* memcpy_ns_read uses a single 8-byte LDR instruction and
* all parameters must be aligned accordingly.
*/
- assert(ALIGNED(size, 8));
- assert(ALIGNED(offset, 8));
- assert(ALIGNED(dest, 8));
+ assert(ALIGNED(size, 8U));
+ assert(ALIGNED(offset, 8U));
+ assert(ALIGNED(dest, 8U));
offset &= ~GRANULE_MASK;
assert(offset + size <= GRANULE_SIZE);
@@ -297,9 +295,9 @@
* memcpy_ns_write uses a single 8-byte STR instruction and
* all parameters must be aligned accordingly.
*/
- assert(ALIGNED(size, 8));
- assert(ALIGNED(offset, 8));
- assert(ALIGNED(src, 8));
+ assert(ALIGNED(size, 8U));
+ assert(ALIGNED(offset, 8U));
+ assert(ALIGNED(src, 8U));
offset &= ~GRANULE_MASK;
assert(offset + size <= GRANULE_SIZE);