From patchwork Mon Jun 26 17:54:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Nikolaus Schaller" X-Patchwork-Id: 9810147 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 1B437603F2 for ; Mon, 26 Jun 2017 17:54:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06B692223E for ; Mon, 26 Jun 2017 17:54:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE1A02858B; Mon, 26 Jun 2017 17:54:38 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 77CC92223E for ; Mon, 26 Jun 2017 17:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751376AbdFZRyZ (ORCPT ); Mon, 26 Jun 2017 13:54:25 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.218]:20092 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbdFZRyY (ORCPT ); Mon, 26 Jun 2017 13:54:24 -0400 X-Greylist: delayed 42760 seconds by postgrey-1.27 at vger.kernel.org; Mon, 26 Jun 2017 13:54:24 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1498499662; l=869; s=domk; d=goldelico.com; h=Date:Subject:Cc:To:From; bh=jTiuVymlOw6x7KrMrQ44eiO4dnKz7lVkwdThOhK7Jrs=; b=QVbLDEfjzBKQazFoiWh0PkXHliqdwFg0DJBL5pHDJbQGrYX32vit5Se8VCRKtptUuf O6PImi+zIuAT/kY4all/4lw9vN9cb/eZ5o+WSmeT86CydiXfxiI0NFbkzZtz2/lqoKiq 9hqSS0W6+pSiYqMMLiwghfp4HzbufDY1fu6fU= X-RZG-AUTH: :JGIXVUS7cutRB/49FwqZ7WcecEarQROEYabkiUo6mSAGQ+qKID8yPJWK6w== X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain (p57AE0E2E.dip0.t-ipconnect.de [87.174.14.46]) by smtp.strato.de (RZmta 41.0 DYNA|AUTH) with ESMTPSA id w03374t5QHsKpOm (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Mon, 26 Jun 2017 19:54:20 +0200 (CEST) From: "H. Nikolaus Schaller" To: Laurent Pinchart , Mauro Carvalho Chehab , s-anna@ti.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, "H. Nikolaus Schaller" Subject: [PATCH] media: omap3isp: handle NULL return of omap3isp_video_format_info() in ccdc_is_shiftable(). Date: Mon, 26 Jun 2017 19:54:19 +0200 Message-Id: X-Mailer: git-send-email 2.12.2 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 If a camera module driver specifies a format that is not supported by omap3isp this ends in a NULL pointer dereference instead of a simple fail. Signed-off-by: H. Nikolaus Schaller --- drivers/media/platform/omap3isp/ispccdc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c index 2fb755f20a6b..dcf16ee7c612 100644 --- a/drivers/media/platform/omap3isp/ispccdc.c +++ b/drivers/media/platform/omap3isp/ispccdc.c @@ -2397,6 +2397,9 @@ static bool ccdc_is_shiftable(u32 in, u32 out, unsigned int additional_shift) in_info = omap3isp_video_format_info(in); out_info = omap3isp_video_format_info(out); + if (!in_info || !out_info) + return false; + if ((in_info->flavor == 0) || (out_info->flavor == 0)) return false;