linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 4556/7806] arch/x86/kvm/mmu/page_track.c:95:39-45: ERROR: application of sizeof to pointer
@ 2021-10-13  9:08 kernel test robot
  2021-10-13  9:08 ` [PATCH] KVM: x86: fix noderef.cocci warnings kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-10-13  9:08 UTC (permalink / raw)
  To: David Stevens; +Cc: kbuild-all, Linux Memory Management List, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8006b911c90a4ec09958447d24c8a4c3538f5723
commit: deae4a10f16649d9c8bfb89f38b61930fb938284 [4556/7806] KVM: x86: only allocate gfn_track when necessary
config: i386-randconfig-c023-20211012 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cocci warnings: (new ones prefixed by >>)
>> arch/x86/kvm/mmu/page_track.c:95:39-45: ERROR: application of sizeof to pointer

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33119 bytes --]

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

* [PATCH] KVM: x86: fix noderef.cocci warnings
  2021-10-13  9:08 [linux-next:master 4556/7806] arch/x86/kvm/mmu/page_track.c:95:39-45: ERROR: application of sizeof to pointer kernel test robot
@ 2021-10-13  9:08 ` kernel test robot
  2021-10-13 11:03   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-10-13  9:08 UTC (permalink / raw)
  To: David Stevens
  Cc: kbuild-all, Linux Memory Management List, Paolo Bonzini,
	Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, Thomas Gleixner, Ingo Molnar, Borislav Petkov

From: kernel test robot <lkp@intel.com>

arch/x86/kvm/mmu/page_track.c:95:39-45: ERROR: application of sizeof to pointer

 sizeof when applied to a pointer typed expression gives the size of
 the pointer

Generated by: scripts/coccinelle/misc/noderef.cocci

Fixes: deae4a10f166 ("KVM: x86: only allocate gfn_track when necessary")
CC: David Stevens <stevensd@chromium.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8006b911c90a4ec09958447d24c8a4c3538f5723
commit: deae4a10f16649d9c8bfb89f38b61930fb938284 [4556/7806] KVM: x86: only allocate gfn_track when necessary
:::::: branch date: 3 hours ago
:::::: commit date: 12 days ago

 page_track.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/x86/kvm/mmu/page_track.c
+++ b/arch/x86/kvm/mmu/page_track.c
@@ -92,7 +92,8 @@ int kvm_page_track_enable_mmu_write_trac
 		slots = __kvm_memslots(kvm, i);
 		kvm_for_each_memslot(slot, slots) {
 			gfn_track = slot->arch.gfn_track + KVM_PAGE_TRACK_WRITE;
-			*gfn_track = kvcalloc(slot->npages, sizeof(*gfn_track),
+			*gfn_track = kvcalloc(slot->npages,
+					      sizeof(**gfn_track),
 					      GFP_KERNEL_ACCOUNT);
 			if (*gfn_track == NULL) {
 				mutex_unlock(&kvm->slots_arch_lock);


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

* Re: [PATCH] KVM: x86: fix noderef.cocci warnings
  2021-10-13  9:08 ` [PATCH] KVM: x86: fix noderef.cocci warnings kernel test robot
@ 2021-10-13 11:03   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2021-10-13 11:03 UTC (permalink / raw)
  To: kernel test robot, David Stevens
  Cc: kbuild-all, Linux Memory Management List, Sean Christopherson,
	Vitaly Kuznetsov, Wanpeng Li, Jim Mattson, Joerg Roedel,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov

On 13/10/21 11:08, kernel test robot wrote:
> From: kernel test robot <lkp@intel.com>
> 
> arch/x86/kvm/mmu/page_track.c:95:39-45: ERROR: application of sizeof to pointer
> 
>   sizeof when applied to a pointer typed expression gives the size of
>   the pointer
> 
> Generated by: scripts/coccinelle/misc/noderef.cocci
> 
> Fixes: deae4a10f166 ("KVM: x86: only allocate gfn_track when necessary")
> CC: David Stevens <stevensd@chromium.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> ---
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   8006b911c90a4ec09958447d24c8a4c3538f5723
> commit: deae4a10f16649d9c8bfb89f38b61930fb938284 [4556/7806] KVM: x86: only allocate gfn_track when necessary
> :::::: branch date: 3 hours ago
> :::::: commit date: 12 days ago
> 
>   page_track.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> --- a/arch/x86/kvm/mmu/page_track.c
> +++ b/arch/x86/kvm/mmu/page_track.c
> @@ -92,7 +92,8 @@ int kvm_page_track_enable_mmu_write_trac
>   		slots = __kvm_memslots(kvm, i);
>   		kvm_for_each_memslot(slot, slots) {
>   			gfn_track = slot->arch.gfn_track + KVM_PAGE_TRACK_WRITE;
> -			*gfn_track = kvcalloc(slot->npages, sizeof(*gfn_track),
> +			*gfn_track = kvcalloc(slot->npages,
> +					      sizeof(**gfn_track),
>   					      GFP_KERNEL_ACCOUNT);
>   			if (*gfn_track == NULL) {
>   				mutex_unlock(&kvm->slots_arch_lock);
> 

There's already a patch on list here, I should apply it soon.

Paolo



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

end of thread, other threads:[~2021-10-13 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13  9:08 [linux-next:master 4556/7806] arch/x86/kvm/mmu/page_track.c:95:39-45: ERROR: application of sizeof to pointer kernel test robot
2021-10-13  9:08 ` [PATCH] KVM: x86: fix noderef.cocci warnings kernel test robot
2021-10-13 11:03   ` Paolo Bonzini

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).