lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <923f4d1b576295ea738df052543e4ca0be2ea616.camel@linux.ibm.com>
Date:   Thu, 25 Aug 2022 21:27:24 +0200
From:   Janis Schoetterl-Glausch <scgl@...ux.ibm.com>
To:     Heiko Carstens <hca@...ux.ibm.com>
Cc:     Christian Borntraeger <borntraeger@...ux.ibm.com>,
        Janosch Frank <frankja@...ux.ibm.com>,
        Claudio Imbrenda <imbrenda@...ux.ibm.com>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        kernel test robot <lkp@...el.com>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        David Hildenbrand <david@...hat.com>,
        Sven Schnelle <svens@...ux.ibm.com>, kvm@...r.kernel.org,
        linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: s390: Pass initialized arg even if unused

On Thu, 2022-08-25 at 10:30 +0200, Heiko Carstens wrote:
> On Wed, Aug 24, 2022 at 05:30:11PM +0200, Janis Schoetterl-Glausch wrote:
> > This silences smatch warnings reported by kbuild bot:
> > arch/s390/kvm/gaccess.c:859 guest_range_to_gpas() error: uninitialized symbol 'prot'.
> > arch/s390/kvm/gaccess.c:1064 access_guest_with_key() error: uninitialized symbol 'prot'.
> > 
> > This is because it cannot tell that the value is not used in this case.
> > The trans_exc* only examine prot if code is PGM_PROTECTION.
> > Pass a dummy value for other codes.
> > 
> > Reported-by: kernel test robot <lkp@...el.com>
> > Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> > Signed-off-by: Janis Schoetterl-Glausch <scgl@...ux.ibm.com>
> > ---
> >  arch/s390/kvm/gaccess.c | 15 ++++++++++++---
> >  1 file changed, 12 insertions(+), 3 deletions(-)

[...]

> >  			gpa = kvm_s390_real_to_abs(vcpu, ga);
> > -			if (kvm_is_error_gpa(vcpu->kvm, gpa))
> > +			if (kvm_is_error_gpa(vcpu->kvm, gpa)) {
> >  				rc = PGM_ADDRESSING;
> > +				prot = PROT_NONE;
> > +			}
> ...
> > +		if (rc == PGM_PROTECTION)
> > +			prot = PROT_TYPE_KEYC;
> > +		else
> > +			prot = PROT_NONE;
> 
> For both cases I would suggest to preinitialize prot with PROT_NONE in
> order to keep the code smaller - but not my call.

I chose this to make it really obvious that PROT_NONE is used only in
cases where code != PGM_PROTECTION.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ