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: <20130129163603.GD627@redhat.com>
Date:	Tue, 29 Jan 2013 18:36:03 +0200
From:	Gleb Natapov <gleb@...hat.com>
To:	Emil Goode <emilgoode@...il.com>
Cc:	mtosatti@...hat.com, tglx@...utronix.de, mingo@...hat.com,
	hpa@...or.com, avi@...hat.com, mst@...hat.com, perex@...ex.cz,
	tiwai@...e.de, crimsun@...ntu.com, wfp5p@...ginia.edu,
	peter.senna@...il.com, x86@...nel.org, kvm@...r.kernel.org,
	alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/3] x86: KVM: Fix warnings by returning bool

On Sun, Jan 27, 2013 at 05:40:00PM +0100, Emil Goode wrote:
> The function pointer x2apic_available in struct hypervisor_x86 is
> supposed to point to functions that return bool. This patch changes
> the return type of the kvm_para_available function to bool.
> 
> Sparse warnings:
> 
> arch/x86/kernel/kvm.c:508:35: warning:
> 	incorrect type in initializer (different signedness)
> 	arch/x86/kernel/kvm.c:508:35:
> 	expected bool ( *x2apic_available )( ... )
> 	arch/x86/kernel/kvm.c:508:35:
> 	got int ( static inline [toplevel] *<noident> )( ... )
> 
> arch/x86/kernel/kvm.c:508:2: warning:
> 	initialization from incompatible pointer type [enabled by default]
> 
> arch/x86/kernel/kvm.c:508:2: warning:
> 	(near initialization for ‘x86_hyper_kvm.x2apic_available’)
> 	[enabled by default]
> 
The breakage was in tip x86/apic tree only and it was fixed by
3b4a505821 there.

> Signed-off-by: Emil Goode <emilgoode@...il.com>
> ---
>  arch/x86/include/asm/kvm_para.h |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
> index 0be7039..695399f 100644
> --- a/arch/x86/include/asm/kvm_para.h
> +++ b/arch/x86/include/asm/kvm_para.h
> @@ -85,13 +85,13 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
>  	return ret;
>  }
>  
> -static inline int kvm_para_available(void)
> +static inline bool kvm_para_available(void)
>  {
>  	unsigned int eax, ebx, ecx, edx;
>  	char signature[13];
>  
>  	if (boot_cpu_data.cpuid_level < 0)
> -		return 0;	/* So we don't blow up on old processors */
> +		return false;	/* So we don't blow up on old processors */
>  
>  	if (cpu_has_hypervisor) {
>  		cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx);
> @@ -101,10 +101,10 @@ static inline int kvm_para_available(void)
>  		signature[12] = 0;
>  
>  		if (strcmp(signature, "KVMKVMKVM") == 0)
> -			return 1;
> +			return true;
>  	}
>  
> -	return 0;
> +	return false;
>  }
>  
>  static inline unsigned int kvm_arch_para_features(void)
> -- 
> 1.7.10.4

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ