diff mbox series

[XEN,5/5] xen/wait: address violations of MISRA C Rule 11.9

Message ID a4e13ba24ab54895454d8df1c956865f7cf7f0b5.1702553835.git.nicola.vetrini@bugseng.com (mailing list archive)
State New
Headers show
Series address remaining violations of MISRA C:2012 Rule 11.9 | expand

Commit Message

Nicola Vetrini Dec. 14, 2023, 11:44 a.m. UTC
No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 xen/common/wait.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefano Stabellini Dec. 14, 2023, 9:33 p.m. UTC | #1
On Thu, 14 Dec 2023, Nicola Vetrini wrote:
> No functional change.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Jan Beulich Dec. 19, 2023, 10:48 a.m. UTC | #2
On 14.12.2023 12:44, Nicola Vetrini wrote:
> No functional change.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

Nevertheless, imo ...

> --- a/xen/common/wait.c
> +++ b/xen/common/wait.c
> @@ -125,7 +125,7 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
>      struct vcpu *curr = current;
>      unsigned long dummy;
>  
> -    ASSERT(wqv->esp == 0);
> +    ASSERT(wqv->esp == NULL);
>  
>      /* Save current VCPU affinity; force wakeup on *this* CPU only. */
>      if ( vcpu_temporary_affinity(curr, smp_processor_id(), VCPU_AFFINITY_WAIT) )
> @@ -171,7 +171,7 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
>            [sz] "i" (PAGE_SIZE)
>          : "memory", "rax", "rdx", "r8", "r9", "r10", "r11" );
>  
> -    if ( unlikely(wqv->esp == 0) )
> +    if ( unlikely(wqv->esp == NULL) )
>      {
>          gdprintk(XENLOG_ERR, "Stack too large in %s\n", __func__);
>          domain_crash(curr->domain);

... in both cases the better change (more in line with what we do elsewhere,
even if not liked by Misra and hence being deviated by us) would have been
to use ! in place of == NULL.

Jan
diff mbox series

Patch

diff --git a/xen/common/wait.c b/xen/common/wait.c
index 86d3b15419db..cb6f5ff3c20a 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -125,7 +125,7 @@  static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
     struct vcpu *curr = current;
     unsigned long dummy;
 
-    ASSERT(wqv->esp == 0);
+    ASSERT(wqv->esp == NULL);
 
     /* Save current VCPU affinity; force wakeup on *this* CPU only. */
     if ( vcpu_temporary_affinity(curr, smp_processor_id(), VCPU_AFFINITY_WAIT) )
@@ -171,7 +171,7 @@  static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
           [sz] "i" (PAGE_SIZE)
         : "memory", "rax", "rdx", "r8", "r9", "r10", "r11" );
 
-    if ( unlikely(wqv->esp == 0) )
+    if ( unlikely(wqv->esp == NULL) )
     {
         gdprintk(XENLOG_ERR, "Stack too large in %s\n", __func__);
         domain_crash(curr->domain);