Skip to content

Commit 1c14faa

Browse files
mmhalbonzini
authored andcommitted
KVM: x86/xen: Simplify eventfd IOCTLs
Port number is validated in kvm_xen_setattr_evtchn(). Remove superfluous checks in kvm_xen_eventfd_assign() and kvm_xen_eventfd_update(). Signed-off-by: Michal Luczaj <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Signed-off-by: David Woodhouse <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 70eae03 commit 1c14faa

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

arch/x86/kvm/xen.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,9 +1810,6 @@ static int kvm_xen_eventfd_update(struct kvm *kvm,
18101810
struct evtchnfd *evtchnfd;
18111811
int ret;
18121812

1813-
if (!port || port >= max_evtchn_port(kvm))
1814-
return -EINVAL;
1815-
18161813
/* Protect writes to evtchnfd as well as the idr lookup. */
18171814
mutex_lock(&kvm->lock);
18181815
evtchnfd = idr_find(&kvm->arch.xen.evtchn_ports, port);
@@ -1858,12 +1855,9 @@ static int kvm_xen_eventfd_assign(struct kvm *kvm,
18581855
{
18591856
u32 port = data->u.evtchn.send_port;
18601857
struct eventfd_ctx *eventfd = NULL;
1861-
struct evtchnfd *evtchnfd = NULL;
1858+
struct evtchnfd *evtchnfd;
18621859
int ret = -EINVAL;
18631860

1864-
if (!port || port >= max_evtchn_port(kvm))
1865-
return -EINVAL;
1866-
18671861
evtchnfd = kzalloc(sizeof(struct evtchnfd), GFP_KERNEL);
18681862
if (!evtchnfd)
18691863
return -ENOMEM;

0 commit comments

Comments
 (0)