From patchwork Tue Jul 11 19:07:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 9835425 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 0BA77602A0 for ; Tue, 11 Jul 2017 19:08:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4B2F2842B for ; Tue, 11 Jul 2017 19:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7A7828528; Tue, 11 Jul 2017 19:08:01 +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=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 1AE7B2842B for ; Tue, 11 Jul 2017 19:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932841AbdGKTIA (ORCPT ); Tue, 11 Jul 2017 15:08:00 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:34675 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932750AbdGKTH7 (ORCPT ); Tue, 11 Jul 2017 15:07:59 -0400 Received: by mail-pf0-f171.google.com with SMTP id q85so653861pfq.1 for ; Tue, 11 Jul 2017 12:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n2jR8p7HxTVTi89grn8z3i6Z7o47yTIjO+dYQt7tDD4=; b=jIkGEvFG/6FEKNRR6TJT4Ju2o9I7KolFd1QkQ0N/u8faCvMxtzA+E+I2/5HIlT41IL QnYWGKe6ffVifpCkVhGTgQVqrjYRYc/iNjP5dVEOAlqGkfsDhQkVp52+H90bk30aQTqr 6k8Us1WCnfP5pqCQhQtu5Y/odDaerEzmTDXoLnGQeU066Al3FVGli3mq1DTH4Jk2HeS8 QaXMtIrq7gsbT7OIw35Ot8Dpre3IPtOUg1o5M9hp39WHq6ZXaCVYsEurvE9RNxxaeFhd r/MknR0gcwaS4Pw60ifEl7J2HyYjrkU+XgqC3sQSdv4bYVfIVXqwnewx6ReWi7ctEKia CSrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n2jR8p7HxTVTi89grn8z3i6Z7o47yTIjO+dYQt7tDD4=; b=Z5OB2E3whNvgUopLZChrXbJuMVY7YZ/TGSPEq9L+AVVeBxm9oiGEPZoXYiVy0YN06P KIroi/YDgy7DtYbayzEGRXQzmlK6UM5rqfK0CaL5N5iYqdVcJWc9tqciX/i5lnRQ2Sta yemJHft/PWg7sa6106OL8MzSxZ7bsQu3Wr9TQh0ElyWPzbNPJKQ5cd1MyKM0XshJdeEq E37vX3a006JSDYv2I0BLIMEk3n/JNMR34p/tbQtm5PBa2VFsXHxB0weutneB9ouq/y/+ o8C6qpurzYqj9WiZ9okb6Y7wuobVvtfZShvWY65bMcTTemTzKn1VuNWwuL9LlUodv0HT 05FA== X-Gm-Message-State: AIVw113GTXhhvL3uPDrqrRi+Ko7Q33fIx0TB5khZlAwVkEgg6D/AvALK d/igQSfeTluXyMw8 X-Received: by 10.101.69.135 with SMTP id o7mr1369369pgq.242.1499800078468; Tue, 11 Jul 2017 12:07:58 -0700 (PDT) Received: from localhost (c-98-203-232-209.hsd1.wa.comcast.net. [98.203.232.209]) by smtp.gmail.com with ESMTPSA id d70sm95949pga.49.2017.07.11.12.07.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 12:07:57 -0700 (PDT) From: Kevin Hilman To: Hans Verkuil , linux-media@vger.kernel.org Cc: Dan Carpenter , Sekhar Nori Subject: [PATCH] [media] davinci: vpif_capture: fix potential NULL deref Date: Tue, 11 Jul 2017 12:07:52 -0700 Message-Id: <20170711190752.30142-1-khilman@baylibre.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix potential NULL pointer dereference in the error path of memory allocation failure. Reported-by: Dan Carpenter Signed-off-by: Kevin Hilman Acked-by: Sakari Ailus --- drivers/media/platform/davinci/vpif_capture.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index d78580f9e431..2e36d8a9f5e3 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1593,10 +1593,12 @@ vpif_capture_get_pdata(struct platform_device *pdev) } done: - pdata->asd_sizes[0] = i; - pdata->subdev_count = i; - pdata->card_name = "DA850/OMAP-L138 Video Capture"; - + if (pdata) { + pdata->asd_sizes[0] = i; + pdata->subdev_count = i; + pdata->card_name = "DA850/OMAP-L138 Video Capture"; + } + return pdata; }