lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 22 Feb 2018 19:25:18 -0500 From: Boris Ostrovsky <boris.ostrovsky@...cle.com> To: Oleksandr Andrushchenko <andr2000@...il.com>, xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org, airlied@...ux.ie, daniel.vetter@...el.com, seanpaul@...omium.org, gustavo@...ovan.org, jgross@...e.com, konrad.wilk@...cle.com Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@...m.com> Subject: Re: [PATCH 5/9] drm/xen-front: Implement handling of shared display buffers On 02/21/2018 03:03 AM, Oleksandr Andrushchenko wrote: > > static int __init xen_drv_init(void) > { > + /* At the moment we only support case with XEN_PAGE_SIZE == PAGE_SIZE */ > + BUILD_BUG_ON(XEN_PAGE_SIZE != PAGE_SIZE); Why BUILD_BUG_ON? This should simply not load if page sizes are different. > + ret = gnttab_map_refs(map_ops, NULL, buf->pages, buf->num_pages); > + BUG_ON(ret); We should try not to BUG*(). There are a few in this patch (and possibly others) that I think can be avoided. > + > +static int alloc_storage(struct xen_drm_front_shbuf *buf) > +{ > + if (buf->sgt) { > + buf->pages = kvmalloc_array(buf->num_pages, > + sizeof(struct page *), GFP_KERNEL); > + if (!buf->pages) > + return -ENOMEM; > + > + if (drm_prime_sg_to_page_addr_arrays(buf->sgt, buf->pages, > + NULL, buf->num_pages) < 0) > + return -EINVAL; > + } > + > + buf->grefs = kcalloc(buf->num_grefs, sizeof(*buf->grefs), GFP_KERNEL); > + if (!buf->grefs) > + return -ENOMEM; > + > + buf->directory = kcalloc(get_num_pages_dir(buf), PAGE_SIZE, GFP_KERNEL); > + if (!buf->directory) > + return -ENOMEM; You need to clean up on errors. -boris > + > + return 0; > +}
Powered by blists - more mailing lists