diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2007-02-09 11:38:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-09 12:14:07 -0500 |
commit | 2f3669879955e2da10558f39aafe0fe13d639458 (patch) | |
tree | a5eb68f081c813429f29321f1dcadeb47f5eb000 | |
parent | 193d0732920fd09825501136f3a01e9c28a700e6 (diff) |
[PATCH] kvm: __user annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/kvm/kvm_main.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index b10972ed0c9f..a55354009cbb 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1778,6 +1778,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1778 | unsigned int ioctl, unsigned long arg) | 1778 | unsigned int ioctl, unsigned long arg) |
1779 | { | 1779 | { |
1780 | struct kvm *kvm = filp->private_data; | 1780 | struct kvm *kvm = filp->private_data; |
1781 | void __user *argp = (void __user *)arg; | ||
1781 | int r = -EINVAL; | 1782 | int r = -EINVAL; |
1782 | 1783 | ||
1783 | switch (ioctl) { | 1784 | switch (ioctl) { |
@@ -1794,12 +1795,12 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1794 | struct kvm_run kvm_run; | 1795 | struct kvm_run kvm_run; |
1795 | 1796 | ||
1796 | r = -EFAULT; | 1797 | r = -EFAULT; |
1797 | if (copy_from_user(&kvm_run, (void *)arg, sizeof kvm_run)) | 1798 | if (copy_from_user(&kvm_run, argp, sizeof kvm_run)) |
1798 | goto out; | 1799 | goto out; |
1799 | r = kvm_dev_ioctl_run(kvm, &kvm_run); | 1800 | r = kvm_dev_ioctl_run(kvm, &kvm_run); |
1800 | if (r < 0 && r != -EINTR) | 1801 | if (r < 0 && r != -EINTR) |
1801 | goto out; | 1802 | goto out; |
1802 | if (copy_to_user((void *)arg, &kvm_run, sizeof kvm_run)) { | 1803 | if (copy_to_user(argp, &kvm_run, sizeof kvm_run)) { |
1803 | r = -EFAULT; | 1804 | r = -EFAULT; |
1804 | goto out; | 1805 | goto out; |
1805 | } | 1806 | } |
@@ -1809,13 +1810,13 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1809 | struct kvm_regs kvm_regs; | 1810 | struct kvm_regs kvm_regs; |
1810 | 1811 | ||
1811 | r = -EFAULT; | 1812 | r = -EFAULT; |
1812 | if (copy_from_user(&kvm_regs, (void *)arg, sizeof kvm_regs)) | 1813 | if (copy_from_user(&kvm_regs, argp, sizeof kvm_regs)) |
1813 | goto out; | 1814 | goto out; |
1814 | r = kvm_dev_ioctl_get_regs(kvm, &kvm_regs); | 1815 | r = kvm_dev_ioctl_get_regs(kvm, &kvm_regs); |
1815 | if (r) | 1816 | if (r) |
1816 | goto out; | 1817 | goto out; |
1817 | r = -EFAULT; | 1818 | r = -EFAULT; |
1818 | if (copy_to_user((void *)arg, &kvm_regs, sizeof kvm_regs)) | 1819 | if (copy_to_user(argp, &kvm_regs, sizeof kvm_regs)) |
1819 | goto out; | 1820 | goto out; |
1820 | r = 0; | 1821 | r = 0; |
1821 | break; | 1822 | break; |
@@ -1824,7 +1825,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1824 | struct kvm_regs kvm_regs; | 1825 | struct kvm_regs kvm_regs; |
1825 | 1826 | ||
1826 | r = -EFAULT; | 1827 | r = -EFAULT; |
1827 | if (copy_from_user(&kvm_regs, (void *)arg, sizeof kvm_regs)) | 1828 | if (copy_from_user(&kvm_regs, argp, sizeof kvm_regs)) |
1828 | goto out; | 1829 | goto out; |
1829 | r = kvm_dev_ioctl_set_regs(kvm, &kvm_regs); | 1830 | r = kvm_dev_ioctl_set_regs(kvm, &kvm_regs); |
1830 | if (r) | 1831 | if (r) |
@@ -1836,13 +1837,13 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1836 | struct kvm_sregs kvm_sregs; | 1837 | struct kvm_sregs kvm_sregs; |
1837 | 1838 | ||
1838 | r = -EFAULT; | 1839 | r = -EFAULT; |
1839 | if (copy_from_user(&kvm_sregs, (void *)arg, sizeof kvm_sregs)) | 1840 | if (copy_from_user(&kvm_sregs, argp, sizeof kvm_sregs)) |
1840 | goto out; | 1841 | goto out; |
1841 | r = kvm_dev_ioctl_get_sregs(kvm, &kvm_sregs); | 1842 | r = kvm_dev_ioctl_get_sregs(kvm, &kvm_sregs); |
1842 | if (r) | 1843 | if (r) |
1843 | goto out; | 1844 | goto out; |
1844 | r = -EFAULT; | 1845 | r = -EFAULT; |
1845 | if (copy_to_user((void *)arg, &kvm_sregs, sizeof kvm_sregs)) | 1846 | if (copy_to_user(argp, &kvm_sregs, sizeof kvm_sregs)) |
1846 | goto out; | 1847 | goto out; |
1847 | r = 0; | 1848 | r = 0; |
1848 | break; | 1849 | break; |
@@ -1851,7 +1852,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1851 | struct kvm_sregs kvm_sregs; | 1852 | struct kvm_sregs kvm_sregs; |
1852 | 1853 | ||
1853 | r = -EFAULT; | 1854 | r = -EFAULT; |
1854 | if (copy_from_user(&kvm_sregs, (void *)arg, sizeof kvm_sregs)) | 1855 | if (copy_from_user(&kvm_sregs, argp, sizeof kvm_sregs)) |
1855 | goto out; | 1856 | goto out; |
1856 | r = kvm_dev_ioctl_set_sregs(kvm, &kvm_sregs); | 1857 | r = kvm_dev_ioctl_set_sregs(kvm, &kvm_sregs); |
1857 | if (r) | 1858 | if (r) |
@@ -1863,13 +1864,13 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1863 | struct kvm_translation tr; | 1864 | struct kvm_translation tr; |
1864 | 1865 | ||
1865 | r = -EFAULT; | 1866 | r = -EFAULT; |
1866 | if (copy_from_user(&tr, (void *)arg, sizeof tr)) | 1867 | if (copy_from_user(&tr, argp, sizeof tr)) |
1867 | goto out; | 1868 | goto out; |
1868 | r = kvm_dev_ioctl_translate(kvm, &tr); | 1869 | r = kvm_dev_ioctl_translate(kvm, &tr); |
1869 | if (r) | 1870 | if (r) |
1870 | goto out; | 1871 | goto out; |
1871 | r = -EFAULT; | 1872 | r = -EFAULT; |
1872 | if (copy_to_user((void *)arg, &tr, sizeof tr)) | 1873 | if (copy_to_user(argp, &tr, sizeof tr)) |
1873 | goto out; | 1874 | goto out; |
1874 | r = 0; | 1875 | r = 0; |
1875 | break; | 1876 | break; |
@@ -1878,7 +1879,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1878 | struct kvm_interrupt irq; | 1879 | struct kvm_interrupt irq; |
1879 | 1880 | ||
1880 | r = -EFAULT; | 1881 | r = -EFAULT; |
1881 | if (copy_from_user(&irq, (void *)arg, sizeof irq)) | 1882 | if (copy_from_user(&irq, argp, sizeof irq)) |
1882 | goto out; | 1883 | goto out; |
1883 | r = kvm_dev_ioctl_interrupt(kvm, &irq); | 1884 | r = kvm_dev_ioctl_interrupt(kvm, &irq); |
1884 | if (r) | 1885 | if (r) |
@@ -1890,7 +1891,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1890 | struct kvm_debug_guest dbg; | 1891 | struct kvm_debug_guest dbg; |
1891 | 1892 | ||
1892 | r = -EFAULT; | 1893 | r = -EFAULT; |
1893 | if (copy_from_user(&dbg, (void *)arg, sizeof dbg)) | 1894 | if (copy_from_user(&dbg, argp, sizeof dbg)) |
1894 | goto out; | 1895 | goto out; |
1895 | r = kvm_dev_ioctl_debug_guest(kvm, &dbg); | 1896 | r = kvm_dev_ioctl_debug_guest(kvm, &dbg); |
1896 | if (r) | 1897 | if (r) |
@@ -1902,7 +1903,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1902 | struct kvm_memory_region kvm_mem; | 1903 | struct kvm_memory_region kvm_mem; |
1903 | 1904 | ||
1904 | r = -EFAULT; | 1905 | r = -EFAULT; |
1905 | if (copy_from_user(&kvm_mem, (void *)arg, sizeof kvm_mem)) | 1906 | if (copy_from_user(&kvm_mem, argp, sizeof kvm_mem)) |
1906 | goto out; | 1907 | goto out; |
1907 | r = kvm_dev_ioctl_set_memory_region(kvm, &kvm_mem); | 1908 | r = kvm_dev_ioctl_set_memory_region(kvm, &kvm_mem); |
1908 | if (r) | 1909 | if (r) |
@@ -1913,7 +1914,7 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1913 | struct kvm_dirty_log log; | 1914 | struct kvm_dirty_log log; |
1914 | 1915 | ||
1915 | r = -EFAULT; | 1916 | r = -EFAULT; |
1916 | if (copy_from_user(&log, (void *)arg, sizeof log)) | 1917 | if (copy_from_user(&log, argp, sizeof log)) |
1917 | goto out; | 1918 | goto out; |
1918 | r = kvm_dev_ioctl_get_dirty_log(kvm, &log); | 1919 | r = kvm_dev_ioctl_get_dirty_log(kvm, &log); |
1919 | if (r) | 1920 | if (r) |
@@ -1921,13 +1922,13 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1921 | break; | 1922 | break; |
1922 | } | 1923 | } |
1923 | case KVM_GET_MSRS: | 1924 | case KVM_GET_MSRS: |
1924 | r = msr_io(kvm, (void __user *)arg, get_msr, 1); | 1925 | r = msr_io(kvm, argp, get_msr, 1); |
1925 | break; | 1926 | break; |
1926 | case KVM_SET_MSRS: | 1927 | case KVM_SET_MSRS: |
1927 | r = msr_io(kvm, (void __user *)arg, do_set_msr, 0); | 1928 | r = msr_io(kvm, argp, do_set_msr, 0); |
1928 | break; | 1929 | break; |
1929 | case KVM_GET_MSR_INDEX_LIST: { | 1930 | case KVM_GET_MSR_INDEX_LIST: { |
1930 | struct kvm_msr_list __user *user_msr_list = (void __user *)arg; | 1931 | struct kvm_msr_list __user *user_msr_list = argp; |
1931 | struct kvm_msr_list msr_list; | 1932 | struct kvm_msr_list msr_list; |
1932 | unsigned n; | 1933 | unsigned n; |
1933 | 1934 | ||