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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ys3LOT/fGcGo+4Eh@osiris>
Date:   Tue, 12 Jul 2022 21:27:53 +0200
From:   Heiko Carstens <hca@...ux.ibm.com>
To:     Claudio Imbrenda <imbrenda@...ux.ibm.com>
Cc:     Steffen Eiden <seiden@...ux.ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ux.ibm.com>,
        Janosch Frank <frankja@...ux.ibm.com>,
        Vasily Gorbik <gor@...ux.ibm.com>, linux-s390@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org, nrb@...ux.ibm.com
Subject: Re: [PATCH 1/3] s390/cpufeature: rework to allow more than only
 hwcap bits

On Tue, Jul 12, 2022 at 06:46:19PM +0200, Claudio Imbrenda wrote:
> > +int cpu_have_feature(unsigned int num)
> > +{
> > +	struct s390_cpu_feature *feature;
> > +
> > +	feature = &s390_cpu_features[num];
> 
> I would put some check to make sure you are going past the end of the
> array. 
> 
> Maybe something like
> 
> if (num >= MAX_CPU_FEATURES) {
> 	WARN(1, "Invalid feature %d", num);
> 	return 0;

That makes sense. I would go for a simple

	if (WARN_ON_ONCE(num >= MAX_CPU_FEATURES))
		return 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ