linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [kvmarm:fixes 18/18] arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here
@ 2025-02-10  1:39 kernel test robot
  2025-02-10  9:21 ` Marc Zyngier
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2025-02-10  1:39 UTC (permalink / raw)
  To: Quentin Perret
  Cc: llvm, oe-kbuild-all, linux-arm-kernel, kvmarm, Marc Zyngier,
	Oliver Upton

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes
head:   eabc7aaef7a553b64bf6e631ce04526af6c8d104
commit: eabc7aaef7a553b64bf6e631ce04526af6c8d104 [18/18] KVM: arm64: Simplify np-guest hypercalls
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250210/202502100911.8c9DbtKD-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250210/202502100911.8c9DbtKD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502100911.8c9DbtKD-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
    1086 |         return ret;
         |                ^~~
   arch/arm64/kvm/hyp/nvhe/mem_protect.c:1076:9: note: initialize the variable 'ret' to silence this warning
    1076 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +/ret +1086 arch/arm64/kvm/hyp/nvhe/mem_protect.c

76f0b18b3db578 Quentin Perret 2024-12-18  1071  
76f0b18b3db578 Quentin Perret 2024-12-18  1072  int __pkvm_host_mkyoung_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu)
76f0b18b3db578 Quentin Perret 2024-12-18  1073  {
76f0b18b3db578 Quentin Perret 2024-12-18  1074  	struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);
76f0b18b3db578 Quentin Perret 2024-12-18  1075  	u64 ipa = hyp_pfn_to_phys(gfn);
76f0b18b3db578 Quentin Perret 2024-12-18  1076  	int ret;
76f0b18b3db578 Quentin Perret 2024-12-18  1077  
eabc7aaef7a553 Quentin Perret 2025-02-07  1078  	if (pkvm_hyp_vm_is_protected(vm))
eabc7aaef7a553 Quentin Perret 2025-02-07  1079  		return -EPERM;
76f0b18b3db578 Quentin Perret 2024-12-18  1080  
eabc7aaef7a553 Quentin Perret 2025-02-07  1081  	assert_host_shared_guest(vm, ipa);
eabc7aaef7a553 Quentin Perret 2025-02-07  1082  	guest_lock_component(vm);
76f0b18b3db578 Quentin Perret 2024-12-18  1083  	kvm_pgtable_stage2_mkyoung(&vm->pgt, ipa, 0);
76f0b18b3db578 Quentin Perret 2024-12-18  1084  	guest_unlock_component(vm);
76f0b18b3db578 Quentin Perret 2024-12-18  1085  
76f0b18b3db578 Quentin Perret 2024-12-18 @1086  	return ret;

:::::: The code at line 1086 was first introduced by commit
:::::: 76f0b18b3db57868fb0cabe691201aad3085b712 KVM: arm64: Introduce __pkvm_host_mkyoung_guest()

:::::: TO: Quentin Perret <qperret@google.com>
:::::: CC: Marc Zyngier <maz@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kvmarm:fixes 18/18] arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here
  2025-02-10  1:39 [kvmarm:fixes 18/18] arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here kernel test robot
@ 2025-02-10  9:21 ` Marc Zyngier
  2025-02-10  9:44   ` Quentin Perret
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2025-02-10  9:21 UTC (permalink / raw)
  To: Quentin Perret, kernel test robot
  Cc: llvm, oe-kbuild-all, linux-arm-kernel, kvmarm, Oliver Upton

On Mon, 10 Feb 2025 01:39:04 +0000,
kernel test robot <lkp@intel.com> wrote:
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes
> head:   eabc7aaef7a553b64bf6e631ce04526af6c8d104
> commit: eabc7aaef7a553b64bf6e631ce04526af6c8d104 [18/18] KVM: arm64: Simplify np-guest hypercalls
> config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250210/202502100911.8c9DbtKD-lkp@intel.com/config)
> compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250210/202502100911.8c9DbtKD-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202502100911.8c9DbtKD-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
>     1086 |         return ret;
>          |                ^~~
>    arch/arm64/kvm/hyp/nvhe/mem_protect.c:1076:9: note: initialize the variable 'ret' to silence this warning
>     1076 |         int ret;
>          |                ^
>          |                 = 0
>    1 warning generated.

Nice catch. I wish the compiler would warn for these by default...

Quentin, are you happy with the following patch that I can stash on
top of the current set of fixes?

	M.

From 5da62486aeda7d7d11107db8ed4e6421e3a2a364 Mon Sep 17 00:00:00 2001
From: Marc Zyngier <maz@kernel.org>
Date: Mon, 10 Feb 2025 09:17:58 +0000
Subject: [PATCH] KVM: arm64: Fix __pkvm_host_mkyoung_guest() return value

Don't use an uninitialised stack variable, and just return 0
on the non-error path.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502100911.8c9DbtKD-lkp@intel.com/
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 arch/arm64/kvm/hyp/nvhe/mem_protect.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
index 4c2f6a6a2efe1..19c3c631708ce 100644
--- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
+++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
@@ -1073,7 +1073,6 @@ int __pkvm_host_mkyoung_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu)
 {
 	struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);
 	u64 ipa = hyp_pfn_to_phys(gfn);
-	int ret;
 
 	if (pkvm_hyp_vm_is_protected(vm))
 		return -EPERM;
@@ -1083,5 +1082,5 @@ int __pkvm_host_mkyoung_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu)
 	kvm_pgtable_stage2_mkyoung(&vm->pgt, ipa, 0);
 	guest_unlock_component(vm);
 
-	return ret;
+	return 0;
 }
-- 
2.39.2


-- 
Without deviation from the norm, progress is not possible.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [kvmarm:fixes 18/18] arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here
  2025-02-10  9:21 ` Marc Zyngier
@ 2025-02-10  9:44   ` Quentin Perret
  2025-02-10 10:37     ` Marc Zyngier
  0 siblings, 1 reply; 5+ messages in thread
From: Quentin Perret @ 2025-02-10  9:44 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: kernel test robot, llvm, oe-kbuild-all, linux-arm-kernel, kvmarm,
	Oliver Upton

On Monday 10 Feb 2025 at 09:21:29 (+0000), Marc Zyngier wrote:
> On Mon, 10 Feb 2025 01:39:04 +0000,
> kernel test robot <lkp@intel.com> wrote:
> > 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes
> > head:   eabc7aaef7a553b64bf6e631ce04526af6c8d104
> > commit: eabc7aaef7a553b64bf6e631ce04526af6c8d104 [18/18] KVM: arm64: Simplify np-guest hypercalls
> > config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250210/202502100911.8c9DbtKD-lkp@intel.com/config)
> > compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250210/202502100911.8c9DbtKD-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202502100911.8c9DbtKD-lkp@intel.com/
> > 
> > All warnings (new ones prefixed by >>):
> > 
> > >> arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
> >     1086 |         return ret;
> >          |                ^~~
> >    arch/arm64/kvm/hyp/nvhe/mem_protect.c:1076:9: note: initialize the variable 'ret' to silence this warning
> >     1076 |         int ret;
> >          |                ^
> >          |                 = 0
> >    1 warning generated.
> 
> Nice catch. I wish the compiler would warn for these by default...

So do I...

> Quentin, are you happy with the following patch that I can stash on
> top of the current set of fixes?

Absolutely, thanks for the patch and sorry the mess!

    Reviewed-by: Quentin Perret <qperret@google.com>

> From 5da62486aeda7d7d11107db8ed4e6421e3a2a364 Mon Sep 17 00:00:00 2001
> From: Marc Zyngier <maz@kernel.org>
> Date: Mon, 10 Feb 2025 09:17:58 +0000
> Subject: [PATCH] KVM: arm64: Fix __pkvm_host_mkyoung_guest() return value
> 
> Don't use an uninitialised stack variable, and just return 0
> on the non-error path.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202502100911.8c9DbtKD-lkp@intel.com/
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
>  arch/arm64/kvm/hyp/nvhe/mem_protect.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> index 4c2f6a6a2efe1..19c3c631708ce 100644
> --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> @@ -1073,7 +1073,6 @@ int __pkvm_host_mkyoung_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu)
>  {
>  	struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);
>  	u64 ipa = hyp_pfn_to_phys(gfn);
> -	int ret;
>  
>  	if (pkvm_hyp_vm_is_protected(vm))
>  		return -EPERM;
> @@ -1083,5 +1082,5 @@ int __pkvm_host_mkyoung_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu)
>  	kvm_pgtable_stage2_mkyoung(&vm->pgt, ipa, 0);
>  	guest_unlock_component(vm);
>  
> -	return ret;
> +	return 0;
>  }
> -- 
> 2.39.2
> 
> 
> -- 
> Without deviation from the norm, progress is not possible.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kvmarm:fixes 18/18] arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here
  2025-02-10  9:44   ` Quentin Perret
@ 2025-02-10 10:37     ` Marc Zyngier
  2025-02-13  7:25       ` Philip Li
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2025-02-10 10:37 UTC (permalink / raw)
  To: Quentin Perret
  Cc: kernel test robot, llvm, oe-kbuild-all, linux-arm-kernel, kvmarm,
	Oliver Upton

On Mon, 10 Feb 2025 09:44:02 +0000,
Quentin Perret <qperret@google.com> wrote:
> 
> On Monday 10 Feb 2025 at 09:21:29 (+0000), Marc Zyngier wrote:
> > On Mon, 10 Feb 2025 01:39:04 +0000,
> > kernel test robot <lkp@intel.com> wrote:
> > > 
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes
> > > head:   eabc7aaef7a553b64bf6e631ce04526af6c8d104
> > > commit: eabc7aaef7a553b64bf6e631ce04526af6c8d104 [18/18] KVM: arm64: Simplify np-guest hypercalls
> > > config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20250210/202502100911.8c9DbtKD-lkp@intel.com/config)
> > > compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250210/202502100911.8c9DbtKD-lkp@intel.com/reproduce)
> > > 
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202502100911.8c9DbtKD-lkp@intel.com/
> > > 
> > > All warnings (new ones prefixed by >>):
> > > 
> > > >> arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
> > >     1086 |         return ret;
> > >          |                ^~~
> > >    arch/arm64/kvm/hyp/nvhe/mem_protect.c:1076:9: note: initialize the variable 'ret' to silence this warning
> > >     1076 |         int ret;
> > >          |                ^
> > >          |                 = 0
> > >    1 warning generated.
> > 
> > Nice catch. I wish the compiler would warn for these by default...
> 
> So do I...
> 
> > Quentin, are you happy with the following patch that I can stash on
> > top of the current set of fixes?
> 
> Absolutely, thanks for the patch and sorry the mess!
> 
>     Reviewed-by: Quentin Perret <qperret@google.com>

Now queued and pushed out.

LKP people: please fix the mailing address you are using, as it
changed over two years ago, and you're still using the old one.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [kvmarm:fixes 18/18] arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here
  2025-02-10 10:37     ` Marc Zyngier
@ 2025-02-13  7:25       ` Philip Li
  0 siblings, 0 replies; 5+ messages in thread
From: Philip Li @ 2025-02-13  7:25 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Quentin Perret, kernel test robot, llvm, oe-kbuild-all,
	linux-arm-kernel, kvmarm, Oliver Upton

On Mon, Feb 10, 2025 at 10:37:03AM +0000, Marc Zyngier wrote:
> On Mon, 10 Feb 2025 09:44:02 +0000,
> Quentin Perret <qperret@google.com> wrote:
> > 
> > On Monday 10 Feb 2025 at 09:21:29 (+0000), Marc Zyngier wrote:
> > > On Mon, 10 Feb 2025 01:39:04 +0000,
> > > kernel test robot <lkp@intel.com> wrote:

[...]

> 
> Now queued and pushed out.
> 
> LKP people: please fix the mailing address you are using, as it
> changed over two years ago, and you're still using the old one.

Got it, thanks for reminding this, we will update to use kvmarm@lists.linux.dev.

> 
> Thanks,
> 
> 	M.
> 
> -- 
> Without deviation from the norm, progress is not possible.
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-13  7:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10  1:39 [kvmarm:fixes 18/18] arch/arm64/kvm/hyp/nvhe/mem_protect.c:1086:9: warning: variable 'ret' is uninitialized when used here kernel test robot
2025-02-10  9:21 ` Marc Zyngier
2025-02-10  9:44   ` Quentin Perret
2025-02-10 10:37     ` Marc Zyngier
2025-02-13  7:25       ` Philip Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).