Re: [PATCH 1/3] s390/cpufeature: rework to allow more than only hwcap bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux