From patchwork Thu Jun 7 14:57:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10452533 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 E4F2360146 for ; Thu, 7 Jun 2018 14:58:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D762C2963B for ; Thu, 7 Jun 2018 14:58:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBD4A2965A; Thu, 7 Jun 2018 14:58:01 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 14BB529639 for ; Thu, 7 Jun 2018 14:58:00 +0000 (UTC) Received: (qmail 5582 invoked by uid 550); 7 Jun 2018 14:57:40 -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 5523 invoked from network); 7 Jun 2018 14:57:39 -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=xsb0j3/KujJNiCnPZvcvW92k5DtDb55gHp7c0RLDjgA=; b=dmZRTYzIwVu26IZrJChBPkz8y vNKA3qg4ZSVUdN+IYrtxAruYr9DAJ3D+MYfJ9CabNI5+VNOa0Az/qOUCBYOxv/7ocH6mhVEk4VFBj NBg8vxtRdubQPip6QfnLQrjt9uzb50wfqHjCS2OwUv+GbuO+g6TIjJRoLfHoHpWUPNBlAJCVmo/Rn 3MJBROaL9nDKxSVMJhLbJ/UDIYto8z9hj35c34TKyYFmSmD04zu+2fb0n84lOSxzUdnBR5pwAC7FN YLyzPP+LRnouQQAaout6hh/gu5pBWvnAkmPfoZtr2ufXhWzuPWnD7pucBBtlCnqlb8IMPXX6eADik t0nV1w63w==; 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 3/6] Convert v4l2 event to struct_size Date: Thu, 7 Jun 2018 07:57:17 -0700 Message-Id: <20180607145720.22590-4-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-Virus-Scanned: ClamAV using ClamSMTP From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- drivers/media/v4l2-core/v4l2-event.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c index 968c2eb08b5a..127fe6eb91d9 100644 --- a/drivers/media/v4l2-core/v4l2-event.c +++ b/drivers/media/v4l2-core/v4l2-event.c @@ -215,8 +215,7 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, if (elems < 1) elems = 1; - sev = kvzalloc(sizeof(*sev) + sizeof(struct v4l2_kevent) * elems, - GFP_KERNEL); + sev = kvzalloc(struct_size(sev, events, elems), GFP_KERNEL); if (!sev) return -ENOMEM; for (i = 0; i < elems; i++)