|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/3] common/kernel: address violation of MISRA C Rule 13.6
In the file common/kernel.c macro ARRAY_SIZE is called with argument
current->domain->handle.
Once expanded, this ARRAY_SIZE's argument is used in sizeof operations
and thus 'current', being a macro that expands to a function
call with potential side effects, generates a violation.
To address this violation the value of current->domain is therefore
stored in a variable called 'd' before passing it to macro ARRAY_SIZE.
No functional change.
Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@xxxxxxxxxxx>
---
xen/common/kernel.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index b44b2439ca..76b4f27aef 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -660,14 +660,15 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void)
arg)
case XENVER_guest_handle:
{
+ struct domain *d = current->domain;
xen_domain_handle_t hdl;
if ( deny )
memset(&hdl, 0, ARRAY_SIZE(hdl));
- BUILD_BUG_ON(ARRAY_SIZE(current->domain->handle) != ARRAY_SIZE(hdl));
+ BUILD_BUG_ON(ARRAY_SIZE(d->handle) != ARRAY_SIZE(hdl));
- if ( copy_to_guest(arg, deny ? hdl : current->domain->handle,
+ if ( copy_to_guest(arg, deny ? hdl : d->handle,
ARRAY_SIZE(hdl) ) )
return -EFAULT;
return 0;
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |