On 26/11/2019 10:07, Pawel Wieczorkiewicz wrote: > @@ -1274,6 +1297,9 @@ static void livepatch_do_action(void) > else > rc = apply_payload(data); > > + if ( !was_action_consistent(data, rc ? LIVEPATCH_FUNC_NOT_APPLIED : > LIVEPATCH_FUNC_APPLIED) ) > + panic("livepatch: partially applied payload '%s'!\n", > data->name); > + > if ( rc == 0 ) > apply_payload_tail(data); > break; > @@ -1288,6 +1314,9 @@ static void livepatch_do_action(void) > else > rc = revert_payload(data); > > + if ( !was_action_consistent(data, rc ? LIVEPATCH_FUNC_APPLIED : > LIVEPATCH_FUNC_NOT_APPLIED) ) > + panic("livepatch: partially reverted payload '%s'!\n", > data->name); > + > if ( rc == 0 ) > revert_payload_tail(data); > break; > @@ -1309,6 +1338,9 @@ 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) ) > + panic("livepatch: partially reverted payload '%s'!\n", > other->name); > + > if ( other->rc == 0 ) > revert_payload_tail(other);
Coverity highlights that this contains dead code. The LIVEPATCH_ACTION_REPLACE case, unlike all others, uses other->rc, which means the rc ? : check will always pass LIVEPATCH_FUNC_APPLIED into was_action_consistent(), due to the rc = 0 at the head of the case block. If this were the only problem, switching rc to other->rc might be ok, but there look to be other confusions in the surrounding code. Would you mind looking over the whole block of code for correct error handling? For any resulting patch, the Coverity ID is 1457467 ~Andrew > else > @@ -1329,6 +1361,9 @@ static void livepatch_do_action(void) > else > rc = apply_payload(data); > > + if ( !was_action_consistent(data, rc ? > LIVEPATCH_FUNC_NOT_APPLIED : LIVEPATCH_FUNC_APPLIED) ) > + panic("livepatch: partially applied payload '%s'!\n", > data->name); > + > if ( rc == 0 ) > apply_payload_tail(data); > } > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel