* [PATCH 3/5] kvm/kvm_main: The ops pointer variable does not need to be initialized and assigned, it is first allocated a memory address
@ 2022-08-12 10:18 Li kunyu
0 siblings, 0 replies; 3+ messages in thread
From: Li kunyu @ 2022-08-12 10:18 UTC (permalink / raw)
To: pbonzini; +Cc: kvm, linux-kernel, Li kunyu
The ops pointer variable does not need to be initialized, because it
first allocates a memory address before it is used.
Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
virt/kvm/kvm_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 80f7934c1f59..82f2b90718a9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -4378,7 +4378,7 @@ void kvm_unregister_device_ops(u32 type)
static int kvm_ioctl_create_device(struct kvm *kvm,
struct kvm_create_device *cd)
{
- const struct kvm_device_ops *ops = NULL;
+ const struct kvm_device_ops *ops;
struct kvm_device *dev;
bool test = cd->flags & KVM_CREATE_DEVICE_TEST;
int type;
--
2.18.2
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/5] kvm/kvm_main: Modify the offset type to size_t, which is consistent with the calling function
@ 2022-08-12 10:15 Li kunyu
2022-08-12 10:24 ` [PATCH 3/5] kvm/kvm_main: The ops pointer variable does not need to be initialized and assigned, it is first allocated a memory address Li kunyu
0 siblings, 1 reply; 3+ messages in thread
From: Li kunyu @ 2022-08-12 10:15 UTC (permalink / raw)
To: pbonzini; +Cc: kvm, linux-kernel, Li kunyu
The offset variable is called size_t in the calling function.
Considering the number of bits in different architectures (32 and 64
represent different types), change it to a consistent variable.
Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
virt/kvm/kvm_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 515dfe9d3bcf..1b9700160eb1 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -5526,7 +5526,7 @@ static const struct file_operations stat_fops_per_vm = {
static int vm_stat_get(void *_offset, u64 *val)
{
- unsigned offset = (long)_offset;
+ size_t offset = (size_t)_offset;
struct kvm *kvm;
u64 tmp_val;
@@ -5542,7 +5542,7 @@ static int vm_stat_get(void *_offset, u64 *val)
static int vm_stat_clear(void *_offset, u64 val)
{
- unsigned offset = (long)_offset;
+ size_t offset = (size_t)_offset;
struct kvm *kvm;
if (val)
@@ -5562,7 +5562,7 @@ DEFINE_SIMPLE_ATTRIBUTE(vm_stat_readonly_fops, vm_stat_get, NULL, "%llu\n");
static int vcpu_stat_get(void *_offset, u64 *val)
{
- unsigned offset = (long)_offset;
+ size_t offset = (size_t)_offset;
struct kvm *kvm;
u64 tmp_val;
@@ -5578,7 +5578,7 @@ static int vcpu_stat_get(void *_offset, u64 *val)
static int vcpu_stat_clear(void *_offset, u64 val)
{
- unsigned offset = (long)_offset;
+ size_t offset = (size_t)_offset;
struct kvm *kvm;
if (val)
--
2.18.2
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 3/5] kvm/kvm_main: The ops pointer variable does not need to be initialized and assigned, it is first allocated a memory address
2022-08-12 10:15 [PATCH 1/5] kvm/kvm_main: Modify the offset type to size_t, which is consistent with the calling function Li kunyu
@ 2022-08-12 10:24 ` Li kunyu
2022-08-18 23:55 ` Sean Christopherson
0 siblings, 1 reply; 3+ messages in thread
From: Li kunyu @ 2022-08-12 10:24 UTC (permalink / raw)
To: pbonzini; +Cc: kvm, linux-kernel, Li kunyu
The ops pointer variable does not need to be initialized, because it
first allocates a memory address before it is used.
Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
virt/kvm/kvm_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 80f7934c1f59..82f2b90718a9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -4378,7 +4378,7 @@ void kvm_unregister_device_ops(u32 type)
static int kvm_ioctl_create_device(struct kvm *kvm,
struct kvm_create_device *cd)
{
- const struct kvm_device_ops *ops = NULL;
+ const struct kvm_device_ops *ops;
struct kvm_device *dev;
bool test = cd->flags & KVM_CREATE_DEVICE_TEST;
int type;
--
2.18.2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 3/5] kvm/kvm_main: The ops pointer variable does not need to be initialized and assigned, it is first allocated a memory address
2022-08-12 10:24 ` [PATCH 3/5] kvm/kvm_main: The ops pointer variable does not need to be initialized and assigned, it is first allocated a memory address Li kunyu
@ 2022-08-18 23:55 ` Sean Christopherson
0 siblings, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2022-08-18 23:55 UTC (permalink / raw)
To: Li kunyu; +Cc: pbonzini, kvm, linux-kernel
Needs a proper shortlog.
On Fri, Aug 12, 2022, Li kunyu wrote:
> The ops pointer variable does not need to be initialized, because it
> first allocates a memory address before it is used.
>
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> ---
Again, with a fixed shortlog,
Reviewed-by: Sean Christopherson <seanjc@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-18 23:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12 10:18 [PATCH 3/5] kvm/kvm_main: The ops pointer variable does not need to be initialized and assigned, it is first allocated a memory address Li kunyu
-- strict thread matches above, loose matches on Subject: below --
2022-08-12 10:15 [PATCH 1/5] kvm/kvm_main: Modify the offset type to size_t, which is consistent with the calling function Li kunyu
2022-08-12 10:24 ` [PATCH 3/5] kvm/kvm_main: The ops pointer variable does not need to be initialized and assigned, it is first allocated a memory address Li kunyu
2022-08-18 23:55 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®