Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2304052imm; Thu, 7 Jun 2018 08:28:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK1Ak44gJN703nwAMmXme3AfPe5JJkZ8clJV8as3otVyZYn7kmRO6E/49EKz2zeHvgVaW4z X-Received: by 2002:a65:47c8:: with SMTP id f8-v6mr1974327pgs.430.1528385327319; Thu, 07 Jun 2018 08:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528385327; cv=none; d=google.com; s=arc-20160816; b=Xd3Pnu3jbgp0TTc3P9Vc37Rdj/SInW1MIpb0GizwKYFB/HFpv+GLkHO+JWWB5i98W4 rENUCQN3Fdbu9h42rP54/9RncBysuT75ryBq2T6I8Rvd99Oc1CLbvqnxVMffGgG9LTk2 gFvZR5A9K5vTuIlAoRJdHe3rhasI02qV3H1melWxfFPPbSqqd2thnrI7Bk3+hxy5AfAL 3s73jTkNaOOlVyBemGp+vaQDPp196kl+D5sz3nLvsfxkwCFm1pcZZ+kNJRdevBM1VpwL 57rZkqfo5PrKn+P2of2YZu5Z547xKRn46xCMihtcczy49pT0lK97Zb1velX2g5EfT0l0 fpKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=xsb0j3/KujJNiCnPZvcvW92k5DtDb55gHp7c0RLDjgA=; b=YQ+2djachjUvqUyRx/SJeGKpJ9OwFAy6i9mf+3Jc3wd7NA2Lhv93WKYj3N4entAkSF Z2kpFpGemKw5WGWWrcwL4j6s4b+dbo/4K2olp8boO3/zdcber13+zhd8p4/irfcI2gF8 JE+XcUfP5M5LxLs4EQYIKmP8pjhsk7iH7EtzwIVhtaFAewOyzyEHEfus9grae+z7zIZ0 t+hJkWnDg9DKESfHSM79F5Q53Az8In6DNy4UMsHlwI0hmdsO8A2/sAomGRmE2Ozk6+5F 5L5uNH72PViHZdX5RSLs5MmbJmb5aN51oR6R0CWmuMBuZVdIfpGl2mM3Nnbdgki/Wqiu PbLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dmZRTYzI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63-v6si39391943pla.140.2018.06.07.08.28.32; Thu, 07 Jun 2018 08:28:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dmZRTYzI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753799AbeFGP1c (ORCPT + 99 others); Thu, 7 Jun 2018 11:27:32 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60218 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933434AbeFGO51 (ORCPT ); Thu, 7 Jun 2018 10:57:27 -0400 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==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQwLt-0005tr-0u; 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 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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++) -- 2.17.0