diff options
| -rw-r--r-- | arch/x86/include/asm/xen/hypercall.h | 3 | ||||
| -rw-r--r-- | drivers/xen/privcmd-buf.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h index de6f0d59a24f..2863c2026655 100644 --- a/arch/x86/include/asm/xen/hypercall.h +++ b/arch/x86/include/asm/xen/hypercall.h | |||
| @@ -206,6 +206,9 @@ xen_single_call(unsigned int call, | |||
| 206 | __HYPERCALL_DECLS; | 206 | __HYPERCALL_DECLS; |
| 207 | __HYPERCALL_5ARG(a1, a2, a3, a4, a5); | 207 | __HYPERCALL_5ARG(a1, a2, a3, a4, a5); |
| 208 | 208 | ||
| 209 | if (call >= PAGE_SIZE / sizeof(hypercall_page[0])) | ||
| 210 | return -EINVAL; | ||
| 211 | |||
| 209 | asm volatile(CALL_NOSPEC | 212 | asm volatile(CALL_NOSPEC |
| 210 | : __HYPERCALL_5PARAM | 213 | : __HYPERCALL_5PARAM |
| 211 | : [thunk_target] "a" (&hypercall_page[call]) | 214 | : [thunk_target] "a" (&hypercall_page[call]) |
diff --git a/drivers/xen/privcmd-buf.c b/drivers/xen/privcmd-buf.c index de01a6d0059d..a1c61e351d3f 100644 --- a/drivers/xen/privcmd-buf.c +++ b/drivers/xen/privcmd-buf.c | |||
| @@ -140,8 +140,7 @@ static int privcmd_buf_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 140 | if (!(vma->vm_flags & VM_SHARED)) | 140 | if (!(vma->vm_flags & VM_SHARED)) |
| 141 | return -EINVAL; | 141 | return -EINVAL; |
| 142 | 142 | ||
| 143 | vma_priv = kzalloc(sizeof(*vma_priv) + count * sizeof(void *), | 143 | vma_priv = kzalloc(struct_size(vma_priv, pages, count), GFP_KERNEL); |
| 144 | GFP_KERNEL); | ||
| 145 | if (!vma_priv) | 144 | if (!vma_priv) |
| 146 | return -ENOMEM; | 145 | return -ENOMEM; |
| 147 | 146 | ||
