[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/2] xen/xenbus: avoid large structs and arrays on the stack
On 11.05.20 20:01, Boris Ostrovsky wrote: On 5/11/20 3:31 AM, Juergen Gross wrote:static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev,I wonder whether we can drop valloc/vfree from xenbus_ring_ops' names. I can do that. + struct map_ring_valloc *info, grant_ref_t *gnt_ref, unsigned int nr_grefs, void **vaddr) { - struct xenbus_map_node *node; + struct xenbus_map_node *node = info->node; int err; void *addr; bool leaked = false; - struct map_ring_valloc_hvm info = { - .idx = 0, - }; unsigned int nr_pages = XENBUS_PAGES(nr_grefs);- if (nr_grefs > XENBUS_MAX_RING_GRANTS)- return -EINVAL; - - *vaddr = NULL; - - node = kzalloc(sizeof(*node), GFP_KERNEL); - if (!node) - return -ENOMEM; - err = alloc_xenballooned_pages(nr_pages, node->hvm.pages); if (err) goto out_err;gnttab_foreach_grant(node->hvm.pages, nr_grefs,xenbus_map_ring_setup_grant_hvm, - &info); + info);err = __xenbus_map_ring(dev, gnt_ref, nr_grefs, node->handles,- info.phys_addrs, GNTMAP_host_map, &leaked); + info, GNTMAP_host_map, &leaked); node->nr_handles = nr_grefs;if (err)@@ -641,11 +654,13 @@ static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev, spin_unlock(&xenbus_valloc_lock);*vaddr = addr;+ info->node = NULL;Is this so that xenbus_map_ring_valloc() doesn't free it accidentally? Yes. Juergen
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |