Skip to contentSkip to conversation

x86: remove redundant checks in sysctl.c

PATCH In review Yi Sun 3 participants 4 messages Aug 31, 2017

lore
Share & tools
lore

Yi Sun

author
#0 lore raw

PATCH 1/2 x86: remove redundant checks in sysctl.c

In sysctl.c, the return value of 'psr_get_info' has been checked immediately. So, it is redundant to check the return value again when copy the field to guest.

---
 xen/arch/x86/sysctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/sysctl.c +2 -2
index 2bde99c..c3fdae8 100644
@@ -190,7 +190,7 @@ long arch_do_sysctl(
             sysctl->u.psr_cat_op.u.cat_info.flags =
                                       data[PSR_INFO_IDX_CAT_FLAG];
 
-            if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
+            if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
                 ret = -EFAULT;
             break;
         }
@@ -209,7 +209,7 @@ long arch_do_sysctl(
             sysctl->u.psr_cat_op.u.cat_info.flags =
                                       data[PSR_INFO_IDX_CAT_FLAG];
 
-            if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
+            if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
                 ret = -EFAULT;
             break;
         }
Signature · 7 lines
1.9.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/2
#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 31.08.17 at 10:07, <[email protected]> wrote:

In sysctl.c, the return value of 'psr_get_info' has been checked immediately. So, it is redundant to check the return value again when copy the field to guest.

Quoted 1 line

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/2
#2 lore raw
In reply to Yi Sun
Quoted 5 lines · Yi Sun

In sysctl.c, the return value of 'psr_get_info' has been checked immediately. So, it is redundant to check the return value again when copy the field to guest.

Thanks!

BTW, the subject line says 1/2, but I cannot find 2/2, is that just a glitch?

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#3 lore raw
Quoted 5 lines · Roger Pau Monn�
Quoted 4 lines · Yi Sun

In sysctl.c, the return value of 'psr_get_info' has been checked immediately. So, it is redundant to check the return value again when copy the field to guest.

Quoted 9 lines
Quoted 1 line

Thanks!

BTW, the subject line says 1/2, but I cannot find 2/2, is that just a glitch?

Oh, sorry, I just executed 'format-patch -2' to create 2 fix patches. But I sent them out one by one. I see you have found the second one. :)

Quoted 1 line

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel