From patchwork Tue Jun 19 13:13:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 10474323 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 A4AA960383 for ; Tue, 19 Jun 2018 13:13:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 968792892B for ; Tue, 19 Jun 2018 13:13:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89A1828C34; Tue, 19 Jun 2018 13:13:51 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D9962892B for ; Tue, 19 Jun 2018 13:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757244AbeFSNNt (ORCPT ); Tue, 19 Jun 2018 09:13:49 -0400 Received: from mail.bugwerft.de ([46.23.86.59]:47340 "EHLO mail.bugwerft.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757240AbeFSNNr (ORCPT ); Tue, 19 Jun 2018 09:13:47 -0400 Received: from localhost.localdomain (pD95EF733.dip0.t-ipconnect.de [217.94.247.51]) by mail.bugwerft.de (Postfix) with ESMTPSA id 32EA728A08A; Tue, 19 Jun 2018 13:10:43 +0000 (UTC) From: Daniel Mack To: b.zolnierkie@samsung.com, tomi.valkeinen@ti.com Cc: linux-fbdev@vger.kernel.org, Daniel Mack , Robert Jarzmik Subject: [PATCH v2] video: fbdev: pxafb: zero allocated memory for video modes Date: Tue, 19 Jun 2018 15:13:32 +0200 Message-Id: <20180619131332.23741-1-daniel@zonque.org> X-Mailer: git-send-email 2.17.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When parsing the video modes from DT properties, make sure to zero out memory befor using it. This is important because not all fields in the mode struct are explicitly initialized, even though they are used later on. Fixes: 420a488278e86 (video: fbdev: pxafb: initial devicetree conversion) Cc: Robert Jarzmik Signed-off-by: Daniel Mack Reviewed-by: Robert Jarzmik --- v2: use kcalloc() instead of open-coding the same through kmalloc_array(__GFP_ZERO) drivers/video/fbdev/pxafb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index c2c2e2790079..4752b218fac4 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2130,8 +2130,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp, return -EINVAL; ret = -ENOMEM; - info->modes = kmalloc_array(timings->num_timings, - sizeof(info->modes[0]), GFP_KERNEL); + info->modes = kcalloc(timings->num_timings, sizeof(info->modes[0]), + GFP_KERNEL); if (!info->modes) goto out; info->num_modes = timings->num_timings;