@@ -80,23 +80,23 @@ def parse_linux_version(kernel_repo):
80
80
81
81
def basic_check (kernel_repo , cve_patch ):
82
82
83
- # try to apply the patch normally
84
- cmd = ["git" , "-C" , kernel_repo , "apply" , "--3way" , "--check" , cve_patch ]
83
+ # try to apply the patch in reverse
84
+ cmd = ["git" , "-C" , kernel_repo , "apply" , "--3way" , "--check" , "--reverse" ,
85
+ cve_patch ]
85
86
try :
86
87
with open (os .devnull , 'w' ) as silence :
87
88
subprocess .check_output (cmd , stderr = silence )
88
- return 0
89
+ return 1
89
90
except subprocess .CalledProcessError :
90
- # we still have one more optiion (reverse patch)
91
+ # not already applied, attempt to apply it
91
92
pass
92
93
93
- # try to apply the patch in reverse
94
- cmd = ["git" , "-C" , kernel_repo , "apply" , "--3way" , "--check" , "--reverse" ,
95
- cve_patch ]
94
+ # try to apply the patch normally
95
+ cmd = ["git" , "-C" , kernel_repo , "apply" , "--3way" , "--check" , cve_patch ]
96
96
try :
97
97
with open (os .devnull , 'w' ) as silence :
98
98
subprocess .check_output (cmd , stderr = silence )
99
- return 1
99
+ return 0
100
100
except subprocess .CalledProcessError :
101
101
# we ran out of options, probably need the advanced check..
102
102
return 2
0 commit comments