diff mbox series

livepatch: use proper rc variable in livepatch_do_action()

Message ID 20200106125623.97666-1-wipawel@amazon.de (mailing list archive)
State New, archived
Headers show
Series livepatch: use proper rc variable in livepatch_do_action() | expand

Commit Message

Wieczorkiewicz, Pawel Jan. 6, 2020, 12:56 p.m. UTC
Fix c&p bug in the livepatch_do_action() code of
LIVEPATCH_ACTION_REPLACE case.
The correct variable handling return code of revert action is
other->rc in this case.

Coverity-ID: 1457467
Fixes: 6047104c3c ("livepatch: Add per-function applied/reverted state tracking marker")
Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/common/livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Konrad Rzeszutek Wilk Jan. 6, 2020, 4:30 p.m. UTC | #1
On Mon, Jan 06, 2020 at 12:56:23PM +0000, Pawel Wieczorkiewicz wrote:
> Fix c&p bug in the livepatch_do_action() code of
> LIVEPATCH_ACTION_REPLACE case.
> The correct variable handling return code of revert action is
> other->rc in this case.
> 
> Coverity-ID: 1457467
> Fixes: 6047104c3c ("livepatch: Add per-function applied/reverted state tracking marker")
> Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> ---
>  xen/common/livepatch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
> index 2a8ab13879..5c67f3de5a 100644
> --- a/xen/common/livepatch.c
> +++ b/xen/common/livepatch.c
> @@ -1456,7 +1456,7 @@ static void livepatch_do_action(void)
>              else
>                  other->rc = revert_payload(other);
>  
> -            if ( !was_action_consistent(other, rc ? LIVEPATCH_FUNC_APPLIED : LIVEPATCH_FUNC_NOT_APPLIED) )
> +            if ( !was_action_consistent(other, other->rc ? LIVEPATCH_FUNC_APPLIED : LIVEPATCH_FUNC_NOT_APPLIED) )
>                  panic("livepatch: partially reverted payload '%s'!\n", other->name);
>  
>              if ( other->rc == 0 )
> -- 
> 2.16.5
> 
> 
> 
> 
> Amazon Development Center Germany GmbH
> Krausenstr. 38
> 10117 Berlin
> Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
> Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
> Sitz: Berlin
> Ust-ID: DE 289 237 879
> 
> 
>
diff mbox series

Patch

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 2a8ab13879..5c67f3de5a 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -1456,7 +1456,7 @@  static void livepatch_do_action(void)
             else
                 other->rc = revert_payload(other);
 
-            if ( !was_action_consistent(other, rc ? LIVEPATCH_FUNC_APPLIED : LIVEPATCH_FUNC_NOT_APPLIED) )
+            if ( !was_action_consistent(other, other->rc ? LIVEPATCH_FUNC_APPLIED : LIVEPATCH_FUNC_NOT_APPLIED) )
                 panic("livepatch: partially reverted payload '%s'!\n", other->name);
 
             if ( other->rc == 0 )