From patchwork Thu Jun 7 14:57:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 10452527 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 2307660146 for ; Thu, 7 Jun 2018 14:57:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13E5A29625 for ; Thu, 7 Jun 2018 14:57:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 078A52963B; Thu, 7 Jun 2018 14:57:44 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3BE029625 for ; Thu, 7 Jun 2018 14:57:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43E336B02A3; Thu, 7 Jun 2018 10:57:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 05F9D6B02AC; Thu, 7 Jun 2018 10:57:28 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8AF56B02AB; Thu, 7 Jun 2018 10:57:28 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 6978F6B02A6 for ; Thu, 7 Jun 2018 10:57:28 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id t17-v6so5544676ply.13 for ; Thu, 07 Jun 2018 07:57:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=doiA9w6bwh4vkmXFcmeOJC1Xglpt77A5WEvXygAnia4=; b=M9jWX4Yd7pNW5SCa2bskOFEFleXQLl/qt8hadVhnxojpTZWjpl/rxGVslZIAgmVTO8 ObMQipQUGp6Ws/XsCM32yrq+sy37eZD4Iw5C3k5X6TuMG0vD2lbAfnWiQgXplzVsM+kE AE0YJIjfq2oJq7C8NNoG4zTvImWo+6dD5ppDbpAkiiqb/+RbuGv9//NfdRe8j24wVKDX 9k8HSqli7/xJLiD7h6kjVtCXI1ArdsfMgHQOJdVO77DS2KW/UkRqfdpjCVcMWkvqslgl eVeTG2ddne61UiEzBBlRskCQZfZLY4zAS69undzm96OYqYRWZ9yYzed2mnS4r6YlST17 1noA== X-Gm-Message-State: APt69E3GX894vUqbiYaQj+TxHYBZYO8DTuKo/tTuHJdGQXDp2/RyZzWn kgFPSzCRs4d3mz+BUCsEE9yz4s0iMdevfNRZ9+0XRZec17wHt0YEQkRBbzlEmvBrJItIC3yn3qQ jwl34f7e5BOSGOJhmK2oBOOGAfnShKgdbBlyMaFi56sBz+zuOelmIMsDXRDVyCaYJqQ== X-Received: by 2002:a17:902:8a82:: with SMTP id p2-v6mr2412359plo.244.1528383448106; Thu, 07 Jun 2018 07:57:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKGomlOgV+ZGRvuUOn/3CB51DrfTSojxj/c8p8frvHrRPW1ogmrcoGltucF156DYkt33Rsp X-Received: by 2002:a17:902:8a82:: with SMTP id p2-v6mr2412298plo.244.1528383446845; Thu, 07 Jun 2018 07:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528383446; cv=none; d=google.com; s=arc-20160816; b=MHXuc3XGOdXtcYWnKzVJnR074t/dMrMvZhJkzWndkgFpKqypUPCmsBG/1aBb3h38uF c9Wzhx5pTeNOGU4jztIYEAX0tObwsIenKCfVVdJNNoK92ALB31V1MWpLECwEA0wNvCHk bfxYS7bWDMg5hKJUrzkuWRKRmJKMO075RU1IycQqiQksNhK+khtAceSty7WjpYW0kZa2 d0RJOszJcmHrssQ4Lz5z0A82Qu/QMb3VvPzPOtURVn3leMSV0DD8MpEZR0vhF3Bbu7fC xdiXcwXDe1AFo3ByVyidO5MOtyZkzv7k30+HHBjKWYNvbz+gmDal/7uJVP3i45gZejDN w3vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=doiA9w6bwh4vkmXFcmeOJC1Xglpt77A5WEvXygAnia4=; b=LrqLGVxoxTRCSJjYIuT2yVAe9PXLArAZdhxgKCOKw8zYaBqQ7pbPezaTfDrsppkgNv rXpNPGihUdQfnpHzfBAIBN2+88d+JXQQ30b+HEoxwS+Im7WC5zg8hnKjhXQHtqC3CCGq m8tnyylNrO4xFfMCuWEfcMdQEVVu4MedZ9EVAez47yXqZWwrwGXBdcar6IsB+vSksagg YHFJwf+oE7rSghsYBTwG1NBY5Bt+UPVHaXYqpiYiSjXUkVkCqBy/Zd0XXVuOKN5VQbjD Gy4EPLFsxJOwwoJQGl8fAkETjlQz87QtO4hf/ka5xaqBtjhdmvxdyHFabP1jz5RQq5R5 PC5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=pELKZo7S; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id y15-v6si7077566pgv.452.2018.06.07.07.57.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Jun 2018 07:57:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=pELKZo7S; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org 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=doiA9w6bwh4vkmXFcmeOJC1Xglpt77A5WEvXygAnia4=; b=pELKZo7SYYzlacQUvbgFtM3E/ 3887Su0JeKqxucWgXuIYzKo77YpMhtZ8UaAzt3O8Mbs+q3E/K3VOjfGtySDiQwH2ww3bwY0BCyH8E wDoKiCIZb6CBs7FhAdqCDQ/Wj63Q/+bXfAIAwRPKvW771SFJgCgefsW6f0uXsHQiOnTPncCm5Q34U ox+EGCNZQYFN3x9tORJBytpKV8WtWK0VBPtujegNNmP9I1u7bBBMZ9I7zF4lBI51Rm9NJqOFlXz2F 9ylOtp2PkukQtFFXyORkrjmyVRgFTrzWNQAgqUK1b8u8PgDoVxzmuQZ5xaDrZLPbeLrRzICU+vgfJ P8N2nxAjQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQwLt-0005u1-GK; Thu, 07 Jun 2018 14:57:25 +0000 From: Matthew Wilcox To: Kees Cook Cc: Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH 5/6] Convert jffs2 acl to struct_size Date: Thu, 7 Jun 2018 07:57:19 -0700 Message-Id: <20180607145720.22590-6-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180607145720.22590-1-willy@infradead.org> References: <20180607145720.22590-1-willy@infradead.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Matthew Wilcox Need to tell the compiler that the acl entries follow the acl header. 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..093ffbd82395 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c @@ -133,7 +133,8 @@ 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 = kmalloc(struct_size(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