From patchwork Thu Aug 17 00:14:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 9904779 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 60A0960231 for ; Thu, 17 Aug 2017 00:14:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50E7D28966 for ; Thu, 17 Aug 2017 00:14:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4412D28A72; Thu, 17 Aug 2017 00:14:02 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 AECA128966 for ; Thu, 17 Aug 2017 00:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751679AbdHQANy (ORCPT ); Wed, 16 Aug 2017 20:13:54 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:37061 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751542AbdHQANx (ORCPT ); Wed, 16 Aug 2017 20:13:53 -0400 Received: by mail-qk0-f196.google.com with SMTP id x77so4799189qka.4 for ; Wed, 16 Aug 2017 17:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=HOaI9+2hXTEx7u7JmO4Abv2aoHteF7ATjBBdVU/Lsds=; b=Ig5Cs0OEOUcPOVe6rtDLvnmIvlEOakGLkFlsxI9yXyMO4FBHUSTSxnpKcysbcXlA/f 5zIqLVglW5Z9t3n3XKOPimpzQ4b0vWx9wYR69M1BwkOhDgVg1bINuTr5u0J1UI7a/l35 ZyA1f1X5M3qtZpmf7YhfH7ieUkTz5ws8HZojyDAINUanK36YJlAqtQ8Qy2DOYVi8X8qn bbg2KPG7Ce3gcT4tq2KH+YDdRF/4aX4D4WrK+bWtenjyzath/TqsviDjz6QMd6dwAdFd A1mbAPGRfv1alLXmDN9vbmhzbSkwJkjzCyVGohwUh95K3buBALmh86vaJRpvFRQHeFC6 ZrLA== 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; bh=HOaI9+2hXTEx7u7JmO4Abv2aoHteF7ATjBBdVU/Lsds=; b=bfuz88W8hBGlThgo+PGQOsQlV69M5QBijFHQ7UbmOqaub7+041EwslcjpxrVqjr0v6 11Of4cooDSY2hz0hbbyAWK8Fny3D4Z5cpDBOCzIFifHdCg1SG+EpKL8nzU5x2BILdViN G3PskOGzlWPnLb61cX9RHfn/zj6CZO0z/RYIC/fhZXD3zJR9caK0iIviISP8O1YhIbh4 tjvAAbl/SaI0m12kAs+SkZJghOJm9euKAkq9oCCFLb6IHjkN13NUyHU298vAsPFZHa6t v7c/mwQGaZQZArVC1ff+V2XOL31E86/up7t1QUA7ZbNSeSUNB73z/WlkDQPUBnYFXXRe F5EQ== X-Gm-Message-State: AHYfb5jUr3VYtJGbXOXLG3llPhpzGgwv5wqDiMnm/RVGVawroBM5qRCH 3YCEt6jGeih0uMXM X-Received: by 10.55.22.169 with SMTP id 41mr4765681qkw.131.1502928833138; Wed, 16 Aug 2017 17:13:53 -0700 (PDT) Received: from localhost.localdomain ([187.180.181.203]) by smtp.gmail.com with ESMTPSA id h47sm1482390qte.67.2017.08.16.17.13.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Aug 2017 17:13:52 -0700 (PDT) From: Fabio Estevam To: p.zabel@pengutronix.de Cc: mchehab@kernel.org, hansverk@cisco.com, linux-media@vger.kernel.org, Fabio Estevam Subject: [PATCH] [media] coda/imx-vdoa: Check for platform_get_resource() error Date: Wed, 16 Aug 2017 21:14:07 -0300 Message-Id: <1502928847-10464-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 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 From: Fabio Estevam platform_get_resource() may fail and in this case a NULL dereference will occur. Prevent this from happening by returning an error on platform_get_resource() failure. Fixes: b0444f18e0b18abce ("[media] coda: add i.MX6 VDOA driver") Signed-off-by: Fabio Estevam Acked-by: Philipp Zabel --- drivers/media/platform/coda/imx-vdoa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/coda/imx-vdoa.c b/drivers/media/platform/coda/imx-vdoa.c index df9b716..8eb3e0c 100644 --- a/drivers/media/platform/coda/imx-vdoa.c +++ b/drivers/media/platform/coda/imx-vdoa.c @@ -314,6 +314,8 @@ static int vdoa_probe(struct platform_device *pdev) return PTR_ERR(vdoa->regs); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) + return -EINVAL; vdoa->irq = devm_request_threaded_irq(&pdev->dev, res->start, NULL, vdoa_irq_handler, IRQF_ONESHOT, "vdoa", vdoa);