lkml.org 
[lkml]   [2022]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kvm: kvm_main: Remove unnecessary (void*) conversions
On Tue, Dec 13, 2022, Li kunyu wrote:
> void * pointer assignment does not require a forced replacement.
>
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
> ---
> virt/kvm/kvm_main.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index fab4d3790578..1682b269ad4a 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -3861,7 +3861,7 @@ static int create_vcpu_fd(struct kvm_vcpu *vcpu)
> #ifdef __KVM_HAVE_ARCH_VCPU_DEBUGFS
> static int vcpu_get_pid(void *data, u64 *val)
> {
> - struct kvm_vcpu *vcpu = (struct kvm_vcpu *) data;
> + struct kvm_vcpu *vcpu = data;
> *val = pid_nr(rcu_access_pointer(vcpu->pid));

Unrelated to your patch: doesn't this need proper RCU protection? E.g. if
KVM_RUN changes vcpu->pid between the read and dereference in pid_nr(), and puts
the last reference to the old pid.

\
 
 \ /
  Last update: 2022-12-16 17:57    [W:0.138 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site