lkml.org 
[lkml]   [2017]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 09/11] KVM: PPC: Book3S: Improve a size determination in two functions
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 20 Jan 2017 16:28:43 +0100

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/powerpc/kvm/book3s_xics.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index 3740f9efcf06..d45c1b59b70a 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -1032,7 +1032,7 @@ static struct kvmppc_ics *kvmppc_xics_create_ics(struct kvm *kvm,
goto out;

/* Create the ICS */
- ics = kzalloc(sizeof(struct kvmppc_ics), GFP_KERNEL);
+ ics = kzalloc(*ics), GFP_KERNEL);
if (!ics)
goto out;

@@ -1064,7 +1064,7 @@ int kvmppc_xics_create_icp(struct kvm_vcpu *vcpu, unsigned long server_num)
if (kvmppc_xics_find_server(vcpu->kvm, server_num))
return -EEXIST;

- icp = kzalloc(sizeof(struct kvmppc_icp), GFP_KERNEL);
+ icp = kzalloc(sizeof(*icp), GFP_KERNEL);
if (!icp)
return -ENOMEM;

--
2.11.0
\
 
 \ /
  Last update: 2017-01-20 19:30    [W:0.380 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site