fix(api): check for empty range or overflow

For `FFA_MEM_PERM_GET` and `FFA_MEM_PERM_SET`, check for an empty range
(`page_count == 0`) or an overflow when calculating the end range.

Change-Id: I0c0b69728c996aa169d1f172a98e62ab5f80ffe9
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/inc/hf/arch/std.h b/inc/hf/arch/std.h
index 2e29e21..ff606b2 100644
--- a/inc/hf/arch/std.h
+++ b/inc/hf/arch/std.h
@@ -38,13 +38,18 @@
 #define align_down(v, a) __builtin_align_down((v), (a))
 
 /*
- * Add operation together with checking whether the operation overflowed
- * The result is '*res',
- * return false on success and true on overflow
+ * Calculate the sum `a + b` and write the result to `*res`.
+ * Returns whether the operation overflowed.
  */
 #define add_overflow(a, b, res) __builtin_add_overflow((a), (b), (res))
 
 /*
+ * Calculate product `a * b` and write the result to `*res`.
+ * Returns whether the operation overflowed.
+ */
+#define mul_overflow(a, b, res) __builtin_mul_overflow((a), (b), (res))
+
+/*
  * Round up a value to align with a given size and
  * check whether overflow happens.
  * The rounded value is '*res', return false on success and true on overflow.