Re: [RFC PATCH v2 1/6] kvm: add device control API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/03/2013 09:34 AM, Scott Wood wrote:
On 04/02/2013 08:28:01 PM, tiejun.chen wrote:
On 04/03/2013 01:30 AM, Scott Wood wrote:
On 04/02/2013 01:59:57 AM, tiejun.chen wrote:
On 04/02/2013 06:47 AM, Scott Wood wrote:
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ff71541..ed033c0 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2158,6 +2158,17 @@ out:
  }
  #endif

+static int kvm_ioctl_create_device(struct kvm *kvm,
+                   struct kvm_create_device *cd)
+{
+    bool test = cd->flags & KVM_CREATE_DEVICE_TEST;
+
+    switch (cd->type) {
+    default:
+        return -ENODEV;
+    }

Even after apply patch 5, looks here still misses something like:

    if (test)
        WARN_ON_ONCE(!cd->type);

Why?  How does userspace passing in a bad type value mean the kernel needs to
report internal badness, why is a value of zero worse than any other bad value,
and why only when the test flag is set?

I just mean we need do something here since looks the 'test' variable is
defined but unused, right? But please correct this as you expect :)

Yes, it's unused in this patch, but is used after patch 5 is applied.  I didn't
think it was worth adding a temporary unused annotation, since this part of the
kernel doesn't use -Werror.

Yes, its accepted in !-Werror case if we shouldn't warn something as you said.

Tiejun

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux