From patchwork Sat Dec 19 12:14:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 7890231 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BC8819F1AF for ; Sat, 19 Dec 2015 12:15:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DAFB020384 for ; Sat, 19 Dec 2015 12:15:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A6E32035E for ; Sat, 19 Dec 2015 12:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933221AbbLSMPG (ORCPT ); Sat, 19 Dec 2015 07:15:06 -0500 Received: from smtp05.smtpout.orange.fr ([80.12.242.127]:51020 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932443AbbLSMOq (ORCPT ); Sat, 19 Dec 2015 07:14:46 -0500 Received: from belgarion.home ([109.222.211.19]) by mwinf5d61 with ME id vQEj1r0090Rg3NM03QEjTQ; Sat, 19 Dec 2015 13:14:45 +0100 X-ME-Helo: belgarion.home X-ME-Date: Sat, 19 Dec 2015 13:14:45 +0100 X-ME-IP: 109.222.211.19 From: Robert Jarzmik To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Julia Lawall , Robert Jarzmik Subject: [PATCH] video: fbdev: pxafb: fix out of memory error path Date: Sat, 19 Dec 2015 13:14:31 +0100 Message-Id: <1450527271-21841-1-git-send-email-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.1.4 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As seen by Julia, the initial allocation memory is not checked anymore after commit "video: fbdev: pxafb: initial devicetree conversion". Introduce back the removed test. Reported-by: Julia Lawall Signed-off-by: Robert Jarzmik --- drivers/video/fbdev/pxafb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index 8588dd683105..54666424a720 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -2252,6 +2252,8 @@ static int pxafb_probe(struct platform_device *dev) ret = -ENOMEM; pdata = dev_get_platdata(&dev->dev); inf = devm_kmalloc(&dev->dev, sizeof(*inf), GFP_KERNEL); + if (!inf) + goto failed; if (pdata) { *inf = *pdata;