From patchwork Tue Jun 19 09:56:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 10473969 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 B015A6029B for ; Tue, 19 Jun 2018 09:56:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B70C928A6E for ; Tue, 19 Jun 2018 09:56:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB80128A96; Tue, 19 Jun 2018 09:56:40 +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 2D02B28A6E for ; Tue, 19 Jun 2018 09:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937392AbeFSJ4j (ORCPT ); Tue, 19 Jun 2018 05:56:39 -0400 Received: from mail.bugwerft.de ([46.23.86.59]:46190 "EHLO mail.bugwerft.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937361AbeFSJ4j (ORCPT ); Tue, 19 Jun 2018 05:56:39 -0400 Received: from localhost.localdomain (pD95EF733.dip0.t-ipconnect.de [217.94.247.51]) by mail.bugwerft.de (Postfix) with ESMTPSA id 92122289FC1; Tue, 19 Jun 2018 09:53:34 +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] video: fbdev: pxafb: zero allocated memory for video modes Date: Tue, 19 Jun 2018 11:56:15 +0200 Message-Id: <20180619095615.14680-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 --- drivers/video/fbdev/pxafb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index c2c2e2790079..64926c95d06c 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2131,7 +2131,8 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp, ret = -ENOMEM; info->modes = kmalloc_array(timings->num_timings, - sizeof(info->modes[0]), GFP_KERNEL); + sizeof(info->modes[0]), + GFP_KERNEL | __GFP_ZERO); if (!info->modes) goto out; info->num_modes = timings->num_timings;