From patchwork Wed Feb 14 20:11:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10219913 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 A1311601C2 for ; Wed, 14 Feb 2018 20:13:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E15328B40 for ; Wed, 14 Feb 2018 20:13:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 828D428B44; Wed, 14 Feb 2018 20:13:38 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 C0B0328B3C for ; Wed, 14 Feb 2018 20:13:37 +0000 (UTC) Received: (qmail 17584 invoked by uid 550); 14 Feb 2018 20:12:24 -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 16334 invoked from network); 14 Feb 2018 20:12:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=olh2B0R6Wdl2+qoHIDoYnXvwVK14NaW4Mu5R+lvAgNI=; b=Tk6HX5S8BWhg8JwH+9RAaetUk J1Hxi71+cSs0HxFrdNjrxI5HKtdxNEcJJN0Tr2cFs06MyE0JvAnbU2DnycrcCuInkYnSbZAEM7KhC yFsHHfEfWBtwYPQg9q2lHp5TMXxtgokstwwB5KA4lhG9oE4UMG9AQEtjUiw57eOhjYkBeiO/QT4yO kqJ5w9S/qAWvcwCeVomKfx1jYyYoh5TvtRSdOaCcc9WVm93DYaePWN88qgNEPJKS8N7q0WqEyS61X bz3CxlJ1YS1TNgUPcoN0cDe4p83yeTximcsTmTiaBsFCG6Z7YNseZKiSU9APsyLXTb8XsjDpiptM2 A2rnDFfRA==; From: Matthew Wilcox To: Andrew Morton Cc: Matthew Wilcox , linux-mm@kvack.org, Kees Cook , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Joe Perches Subject: [PATCH v2 8/8] Convert jffs2 acl to kvzalloc_struct Date: Wed, 14 Feb 2018 12:11:54 -0800 Message-Id: <20180214201154.10186-9-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180214201154.10186-1-willy@infradead.org> References: <20180214201154.10186-1-willy@infradead.org> X-Virus-Scanned: ClamAV using ClamSMTP From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- fs/jffs2/acl.c | 3 ++- fs/jffs2/acl.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 7ebacf14837f..9df7feffd6ea 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -133,7 +134,7 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size) size_t i; *size = jffs2_acl_size(acl->a_count); - header = kmalloc(sizeof(*header) + acl->a_count * sizeof(*entry), GFP_KERNEL); + header = kvzalloc_struct(header, a_entries, acl->a_count, GFP_KERNEL); if (!header) return ERR_PTR(-ENOMEM); header->a_version = cpu_to_je32(JFFS2_ACL_VERSION); diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h index 2e2b5745c3b7..12d0271bdde3 100644 --- a/fs/jffs2/acl.h +++ b/fs/jffs2/acl.h @@ -22,6 +22,7 @@ struct jffs2_acl_entry_short { struct jffs2_acl_header { jint32_t a_version; + struct jffs2_acl_entry a_entries[]; }; #ifdef CONFIG_JFFS2_FS_POSIX_ACL