Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2065905ybk; Mon, 11 May 2020 11:05:39 -0700 (PDT) X-Google-Smtp-Source: APiQypJuXMXvv2LgPLxbXCDedgfObSqeVhqE2EOnN6PEg1GS5r1O3nWyivOymCNOoNLknhxBMCBV X-Received: by 2002:aa7:d60a:: with SMTP id c10mr15047797edr.66.1589220339681; Mon, 11 May 2020 11:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589220339; cv=none; d=google.com; s=arc-20160816; b=yQWvDt8I0ph9s+aTMj1aMMIr4BJ2cR82WmpydeDaWNrGlvEpfRsUWMv4cyZh+Jrr9R 7TsGRkLrIptwSnpFI/4zAefqCUVGnDmAE93gnNMKMNFApqh6+j8OkCeAVFoHgr/6EN9q NxNSRaTcL7R7dfB3r01qsZjTHS19rep4mcmD1gM3IJ4wGyt2+cfSGodraJ/NpkbEvuMW DhijWoicGt00/h3TypJv0jEjDR1AfXWJyGtjKf902HjMeUrYLt+1uYJnruO5SNpM39rg +zjg3YljcyZSRge9QZYwdsH6EDvrkjM5x9aOnqcnCjix0bRVlAhzeP/9rFtGIw8BW0wj z8hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :dkim-signature; bh=3kDmNoqAEMZCIXkcb0qOJul4sO1nAcYTG6P0n3tKFVY=; b=RktimEu8GYiB748tkLV6H8Tg9oSjAeYVghVE5m1TN0SNBhbRhtCIA/tDh5mtdPmm2+ ymBUpTafS7+rSGegecBDXQpXcHj+9LtpDOIgxGJtARe0sW3s1oVAu5YfhJHioRDMnNMJ 9jVImn6i3FvZ2TCUtfbqw6/aqnvFy+7gAw6dvj/H9LdMazzHN+8FALpaoaaf+zfpsycM 5ZGRY0xMEhnf795ANDWnXleY3BLJSW7XKHBCbAFajWMGCrF5XtL4f7L2+EhZDPR+YCV1 DuKNr+ZErukZ9bfgxvglCTGCzSdLeie4or2qCuKrtciiywOOY8i1YQ7mBroV4g4oMRCe KRhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=J08lgend; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id le12si4523795ejb.185.2020.05.11.11.05.16; Mon, 11 May 2020 11:05:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=J08lgend; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730939AbgEKSB3 (ORCPT + 99 others); Mon, 11 May 2020 14:01:29 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:57792 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbgEKSB3 (ORCPT ); Mon, 11 May 2020 14:01:29 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04BHtoZZ165453; Mon, 11 May 2020 18:01:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type; s=corp-2020-01-29; bh=3kDmNoqAEMZCIXkcb0qOJul4sO1nAcYTG6P0n3tKFVY=; b=J08lgend++x1QqGWYhELUriMEny26k3fyjyCtHH4swF4nr0HlxIWmjm6gN2ExsQJmF8H /fyLBmkUUnyvCvbRxnSJiC80XcRPP1JK6TdepnYLyEbAMDOyn3iDl2UYnhx4+WytAj5t goJLQvhUFu3rVXh5yQKzSQUp2M/XfxaBHWQJFpafh66wNATudAi0/SMvS6l4AekMYfMT vYHpmrhFcBsMuVllX98JKAXFyrWCiMX9vWtV1AqOgtngOkLwEv4Uf90ndO9S1H+Ny+w3 Lbvt7xEibUHNB/tGl63mq4lCiEiqzaDzHO/+Yz+WH3rDFOY7wXj2Of1xVvuflRzBe/Hy mg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 30x3gmenme-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 May 2020 18:01:18 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04BHht2K117945; Mon, 11 May 2020 18:01:18 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 30x6ewggc4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 May 2020 18:01:18 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 04BI1Gwt006639; Mon, 11 May 2020 18:01:16 GMT Received: from [10.39.250.101] (/10.39.250.101) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 11 May 2020 11:01:16 -0700 Subject: Re: [PATCH 1/2] xen/xenbus: avoid large structs and arrays on the stack To: Juergen Gross , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Cc: Stefano Stabellini , Arnd Bergmann References: <20200511073151.19043-1-jgross@suse.com> <20200511073151.19043-2-jgross@suse.com> From: Boris Ostrovsky X-Pep-Version: 2.0 Message-ID: <965e1d65-3a0c-3a71-ca58-2b5c04f98bce@oracle.com> Date: Mon, 11 May 2020 14:01:00 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200511073151.19043-2-jgross@suse.com> Content-Type: multipart/mixed; boundary="------------444D946E3E378382AC37167D" Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9618 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 bulkscore=0 suspectscore=2 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005110139 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9618 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 suspectscore=2 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005110139 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------444D946E3E378382AC37167D Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 5/11/20 3:31 AM, Juergen Gross wrote: > =20 > static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev, I wonder whether we can drop valloc/vfree from xenbus_ring_ops' names. > + 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 =3D info->node; > int err; > void *addr; > bool leaked =3D false; > - struct map_ring_valloc_hvm info =3D { > - .idx =3D 0, > - }; > unsigned int nr_pages =3D XENBUS_PAGES(nr_grefs); > =20 > - if (nr_grefs > XENBUS_MAX_RING_GRANTS) > - return -EINVAL; > - > - *vaddr =3D NULL; > - > - node =3D kzalloc(sizeof(*node), GFP_KERNEL); > - if (!node) > - return -ENOMEM; > - > err =3D alloc_xenballooned_pages(nr_pages, node->hvm.pages); > if (err) > goto out_err; > =20 > gnttab_foreach_grant(node->hvm.pages, nr_grefs, > xenbus_map_ring_setup_grant_hvm, > - &info); > + info); > =20 > err =3D __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 =3D nr_grefs; > =20 > if (err) > @@ -641,11 +654,13 @@ static int xenbus_map_ring_valloc_hvm(struct xenb= us_device *dev, > spin_unlock(&xenbus_valloc_lock); > =20 > *vaddr =3D addr; > + info->node =3D NULL; Is this so that xenbus_map_ring_valloc() doesn't free it accidentally? -boris > + > return 0; > =20 > =20 --------------444D946E3E378382AC37167D Content-Type: application/pgp-keys; name="pEpkey.asc" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pEpkey.asc" -----BEGIN PGP PUBLIC KEY BLOCK----- mQINBFH8CgsBEAC0KiOi9siOvlXatK2xX99e/J3OvApoYWjieVQ9232Eb7GzCWrI tCzP8FUVPQg8rMsSd0OzIvvjbEAvaWLlbs8wa3MtVLysHY/DfqRK9Zvr/RgrsYC6 ukOB7igy2PGqZd+MMDnSmVzik0sPvB6xPV7QyFsykEgpnHbvdZAUy/vyys8xgT0P VYR5hyvhyf6VIfGuvqIsvJw5C8+P71CHI+U/IhsKrLrsiYHpAhQkw+Zvyeml6XSi 5w4LXDbF+3oholKYCkPwxmGdK8MUIdkMd7iYdKqiP4W6FKQou/lC3jvOceGupEoD V9botSWEIIlKdtm6C4GfL45RD8V4B9iy24JHPlomwoVWc0xBZboQguhauQqrBFoo HO3roEeM1pxXjLUbDtH4t3SAI3gt4dpSyT3EvzhyNQVVIxj2FXnICh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