diff mbox

[2/4] ARM: fix cpu feature extracting helper

Message ID 1453800223-18590-3-git-send-email-vladimir.murzin@arm.com
State New, archived
Headers show

Commit Message

Vladimir Murzin Jan. 26, 2016, 9:23 a.m. UTC
Commit b8c9592 "ARM: 8318/1: treat CPU feature register fields as signed
quantities" introduced helper to extract signed quantities of 4-bit
blocks. However, with a current code feature with value 0b1000 isn't
rejected as negative. So fix the "if" condition.

Reported-by: Jonathan Brawn <Jon.Brawn@arm.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm/include/asm/cputype.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ard Biesheuvel Jan. 27, 2016, 9:35 a.m. UTC | #1
On 26 January 2016 at 10:23, Vladimir Murzin <vladimir.murzin@arm.com> wrote:
> Commit b8c9592 "ARM: 8318/1: treat CPU feature register fields as signed
> quantities" introduced helper to extract signed quantities of 4-bit
> blocks. However, with a current code feature with value 0b1000 isn't
> rejected as negative. So fix the "if" condition.
>
> Reported-by: Jonathan Brawn <Jon.Brawn@arm.com>
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  arch/arm/include/asm/cputype.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
> index b23c6c8..1ee94c7 100644
> --- a/arch/arm/include/asm/cputype.h
> +++ b/arch/arm/include/asm/cputype.h
> @@ -276,7 +276,7 @@ static inline int __attribute_const__ cpuid_feature_extract_field(u32 features,
>         int feature = (features >> field) & 15;
>
>         /* feature registers are signed values */
> -       if (feature > 8)
> +       if (feature > 7)
>                 feature -= 16;
>
>         return feature;
> --
> 1.7.9.5
>
diff mbox

Patch

diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index b23c6c8..1ee94c7 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -276,7 +276,7 @@  static inline int __attribute_const__ cpuid_feature_extract_field(u32 features,
 	int feature = (features >> field) & 15;
 
 	/* feature registers are signed values */
-	if (feature > 8)
+	if (feature > 7)
 		feature -= 16;
 
 	return feature;