History

xen/privcmd-buf.c: convert to use vm_map_pages_zero()

Convert to use vm_map_pages_zero() to map range of kernel memory to user vma. This driver has ignored vm_pgoff. We could later "fix" these drivers to behave according to the normal vm_pgoff offsetting simply by removing the _zero suffix on the function name and if that causes regressions, it gives us an easy way to revert.

Souptick Joarder committed 7 years ago

Commit 53269051 parent df9bde01 file · +2 −6Browse files

Unified · Split

drivers/xen/privcmd-buf.c+2−6
@@ -165,12 +165,8 @@ static int privcmd_buf_mmap(struct file *file, struct vm_area_struct *vma) · 164 unmodified lines
165 if (vma_priv->n_pages != count)165 if (vma_priv->n_pages != count)
166 ret = -ENOMEM;166 ret = -ENOMEM;
167 else167 else
168 for (i = 0; i < vma_priv->n_pages; i++) {168 ret = vm_map_pages_zero(vma, vma_priv->pages,
169 ret = vm_insert_page(vma, vma->vm_start + i * PAGE_SIZE,169 vma_priv->n_pages);
170 vma_priv->pages[i]);
171 if (ret)
172 break;
173 }
174 170
175 if (ret)171 if (ret)
176 privcmd_buf_vmapriv_free(vma_priv);172 privcmd_buf_vmapriv_free(vma_priv);