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;




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux