From patchwork Sun Jun 24 15:38:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 10484441 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 784AB60230 for ; Sun, 24 Jun 2018 15:38:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 512F027F54 for ; Sun, 24 Jun 2018 15:38:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44F5F27D4A; Sun, 24 Jun 2018 15:38:31 +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 B4ECE27D4A for ; Sun, 24 Jun 2018 15:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755730AbeFXPi1 (ORCPT ); Sun, 24 Jun 2018 11:38:27 -0400 Received: from mail.bugwerft.de ([46.23.86.59]:50606 "EHLO mail.bugwerft.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755725AbeFXPi0 (ORCPT ); Sun, 24 Jun 2018 11:38:26 -0400 Received: from localhost.localdomain (pD95EF54E.dip0.t-ipconnect.de [217.94.245.78]) by mail.bugwerft.de (Postfix) with ESMTPSA id A974328B199; Sun, 24 Jun 2018 15:35:15 +0000 (UTC) From: Daniel Mack To: b.zolnierkie@samsung.com, tomi.valkeinen@ti.com Cc: linux-fbdev@vger.kernel.org, robert.jarzmik@free.fr, Daniel Mack Subject: [PATCH 1/4] video: fbdev: pxafb: clear allocated memory for video modes Date: Sun, 24 Jun 2018 17:38:14 +0200 Message-Id: <20180624153817.24387-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 before 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) Reviewed-by: Robert Jarzmik Signed-off-by: Daniel Mack --- 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 76722a59f55e..dfe382e68287 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2128,8 +2128,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;