From patchwork Fri Apr 13 22:11:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10340837 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A69760329 for ; Fri, 13 Apr 2018 22:12:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 840DB28A0B for ; Fri, 13 Apr 2018 22:12:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78B5C28A10; Fri, 13 Apr 2018 22:12:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 7FD5F28A0B for ; Fri, 13 Apr 2018 22:12:15 +0000 (UTC) Received: (qmail 11419 invoked by uid 550); 13 Apr 2018 22:12:13 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 11392 invoked from network); 13 Apr 2018 22:12:13 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2/8HjuS2UQuxTlH6dZp1Oqp/dVN0PDHwDYfzQSzjByY=; b=ki0SwCIbAjCgOsoIAGbvctxO6ydGDzQMBpluzHxIwSMMRcbs+CuqjkvfQXMCbzQKuX E9K3BirlAw4CFNE9g6o2iZOZaDUcjzRJOTAwJy1t31aw0v2aHd1ZdGkI3Rr+wEefY0BA hIm7ib+XZfEYmnneuAfo1PhMUGkfwVmTRthx77d52W8vCwySizw/v+gJEY7d1JIyzpdD i4Tql4XpBoimDxoqf2Pj2lTyEedsg/toIfk8ngCaHX//PPq8MGesujv++AD3BmPYVZ7S UpDGUr5S2TjE7lXURHU9qg4GXyqmIX1jvD2cxq0rs+JC9UH+MkbxQgw2QgCCC1fG33Mo 15uQ== X-Gm-Message-State: ALQs6tCAND3FFeUfZt8NcVSIg8oR4bZjY7N9IWdSG+sg/UCcv8gEfXOW CVlKrYjVJjXFJbJ6iqseY+PnFA== X-Google-Smtp-Source: AIpwx4+b0TPACRAXYn8/HCD6nN7eJUA8TKNOtwjhPwxBP90m+aCasyJdGM2ZfEruoYCbRAt3tNKgYw== X-Received: by 2002:a9d:733:: with SMTP id 48-v6mr4554187ote.19.1523657521363; Fri, 13 Apr 2018 15:12:01 -0700 (PDT) From: Laura Abbott To: Boris Ostrovsky , Juergen Gross Cc: Laura Abbott , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH] x86/xen: Remove use of VLAs Date: Fri, 13 Apr 2018 15:11:46 -0700 Message-Id: <20180413221146.28476-1-labbott@redhat.com> X-Mailer: git-send-email 2.14.3 X-Virus-Scanned: ClamAV using ClamSMTP There's an ongoing effort to remove VLAs[1] from the kernel to eventually turn on -Wvla. The few VLAs in use have an upper bound based on a size of 64K. This doesn't produce an excessively large stack so just switch the upper bound. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Laura Abbott Reviewed-by: Juergen Gross Reviewed-by: Ingo Molnar --- arch/x86/xen/enlighten_pv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index c36d23aa6c35..d96a5a535cbb 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -421,8 +421,7 @@ static void xen_load_gdt(const struct desc_ptr *dtr) { unsigned long va = dtr->address; unsigned int size = dtr->size + 1; - unsigned pages = DIV_ROUND_UP(size, PAGE_SIZE); - unsigned long frames[pages]; + unsigned long frames[DIV_ROUND_UP(SZ_64K, PAGE_SIZE)]; int f; /* @@ -470,8 +469,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr) { unsigned long va = dtr->address; unsigned int size = dtr->size + 1; - unsigned pages = DIV_ROUND_UP(size, PAGE_SIZE); - unsigned long frames[pages]; + unsigned long frames[DIV_ROUND_UP(SZ_64K, PAGE_SIZE)]; int f; /*