Message ID | 20241216092140.329196-7-schlameuss@linux.ibm.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | selftests: kvm: s390: Reject invalid ioctls on ucontrol VMs | expand |
On 2024-12-16 10:21, Christoph Schlameuss wrote: > Fixup the uc_attr_mem_limit test case to also cover the > KVM_HAS_DEVICE_ATTR ioctl. > > Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com> Tested-by: Hariharan Mari <hari55@linux.ibm.com> > --- > tools/testing/selftests/kvm/s390x/ucontrol_test.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/s390x/ucontrol_test.c > b/tools/testing/selftests/kvm/s390x/ucontrol_test.c > index ef3e391811b3..087496fe264d 100644 > --- a/tools/testing/selftests/kvm/s390x/ucontrol_test.c > +++ b/tools/testing/selftests/kvm/s390x/ucontrol_test.c > @@ -206,10 +206,13 @@ TEST_F(uc_kvm, uc_attr_mem_limit) > struct kvm_device_attr attr = { > .group = KVM_S390_VM_MEM_CTRL, > .attr = KVM_S390_VM_MEM_LIMIT_SIZE, > - .addr = (unsigned long)&limit, > + .addr = (u64)&limit, > }; > int rc; > > + rc = ioctl(self->vm_fd, KVM_HAS_DEVICE_ATTR, &attr); > + EXPECT_EQ(0, rc); > + > rc = ioctl(self->vm_fd, KVM_GET_DEVICE_ATTR, &attr); > EXPECT_EQ(0, rc); > EXPECT_EQ(~0UL, limit);
diff --git a/tools/testing/selftests/kvm/s390x/ucontrol_test.c b/tools/testing/selftests/kvm/s390x/ucontrol_test.c index ef3e391811b3..087496fe264d 100644 --- a/tools/testing/selftests/kvm/s390x/ucontrol_test.c +++ b/tools/testing/selftests/kvm/s390x/ucontrol_test.c @@ -206,10 +206,13 @@ TEST_F(uc_kvm, uc_attr_mem_limit) struct kvm_device_attr attr = { .group = KVM_S390_VM_MEM_CTRL, .attr = KVM_S390_VM_MEM_LIMIT_SIZE, - .addr = (unsigned long)&limit, + .addr = (u64)&limit, }; int rc; + rc = ioctl(self->vm_fd, KVM_HAS_DEVICE_ATTR, &attr); + EXPECT_EQ(0, rc); + rc = ioctl(self->vm_fd, KVM_GET_DEVICE_ATTR, &attr); EXPECT_EQ(0, rc); EXPECT_EQ(~0UL, limit);
Fixup the uc_attr_mem_limit test case to also cover the KVM_HAS_DEVICE_ATTR ioctl. Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com> --- tools/testing/selftests/kvm/s390x/ucontrol_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)