From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86/mmuext: Unify okay/rc error handling in do_mmuext_op() Date: Tue, 22 Dec 2015 09:09:33 +0000 Message-ID: <5679134D.6070404@citrix.com> References: <1450718160-744-1-git-send-email-andrew.cooper3@citrix.com> <56791E8502000078000C2243@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <56791E8502000078000C2243@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Boris Ostrovsky , Xen-devel List-Id: xen-devel@lists.xenproject.org On 22/12/2015 08:57, Jan Beulich wrote: >>>> On 21.12.15 at 18:16, wrote: >> c/s 506db90 "x86/HVM: merge HVM and PVH hypercall tables" introduced a path >> whereby 'okay' was used uninitialised, with broke compilation on CentOS 7. > It appeared to be used uninitialized, but wasn't in fact (i.e. the > outcome - the value rc gets set to - didn't depend on the value > due to > > if ( unlikely(!okay) && !rc ) > rc = -EINVAL; > > being equivalent to > > if ( !rc && unlikely(!okay) ) > rc = -EINVAL; > > (no side effects for the expressions on either side of the &&). > I'll re-word accordingly upon committing, to not give the false > impression of there having been other than a cosmetic problem. There is a real problem. Because the compiler is able to prove that okay is genuinely read uninitialised in one case, the rules concerning undefined behaviour permit it to do anything it wishes, including omitting this if statement. As far as practical problems go however, it is the build breakage which is relevant, and it breaks because of a -Werror=maybe-uninitialised. ~Andrew