Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6015510ybc; Wed, 27 Nov 2019 13:26:32 -0800 (PST) X-Google-Smtp-Source: APXvYqyCjTXg+p20So07/nmQJ3GSHMTB0wY+qboolUFT6VO0WtMe/6VLQPq7Ga9BNf1DCUoiLC/2 X-Received: by 2002:a17:906:a457:: with SMTP id cb23mr51084512ejb.191.1574889992247; Wed, 27 Nov 2019 13:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574889992; cv=none; d=google.com; s=arc-20160816; b=QCSiTLyPdS/1lJ2XMJa19j+QzlK+ARnJ+SMMcwicO88hArEV9bN3SnizlRBsO/iOQM LIbK5I2ygCGT+cywvKyp31xYMpnbqDe08Rnqt8kTDc5iK3BJQ1Ka/BbNPVexfD4wlJUS ZwaZKJBn6qSvwxVo1sfJYYN9udkEHH3CN2pLTRiDUPPWLye+ddCbXnkUV3znnTAtuZUJ Jz/vAuk81s0kdD3NrcXk0cshl6c6HUUhSglU9g3R+d4Pc97oGNfWNZ9A3zPqlHusFiIu YJmvnTH9cRCfuBvfNlo3HvKGFQfmLMhbtuzK7X9mWnFo0sP36RPPT9QYuUwfg8w0E0G1 WaNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=psSlM3SkSdrwl9TyLopmFhV5Gr2Eqw9Xnrz2ctSSrb4=; b=ORuogfMLM2F02qhKFoBb2bog9igFljkGijKYt9h7QVt64Ovxjw+u3vwJTQcf5vGidn TMTlz/R2Fe5a0xPP4BqTJLH4XlKgoCOIFWCUvy1ynuqFST/FfvDEZwqOobt5/Rh2jzgo VX3wbCY/GQawL827WmwbO7Y7XHgSXXtCetn25RRl263E2qFWabu9NiCQi84x75Cy7R94 efMccdHLefOQ960SX4wSByItlNSDS0/BebxnfnikhK26iziTq3xLgOp21HqSgDMPgStP p1IxhkFGUy/sUrM1YBVg0GgysdmEm7bjy/TStM43TRglI0zW2I07DQH+Vy00WdhmSbGY l0Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ecsfsJgh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o22si10693921ejr.78.2019.11.27.13.26.08; Wed, 27 Nov 2019 13:26:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ecsfsJgh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732735AbfK0VXz (ORCPT + 99 others); Wed, 27 Nov 2019 16:23:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:57266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732097AbfK0VD5 (ORCPT ); Wed, 27 Nov 2019 16:03:57 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB5602086A; Wed, 27 Nov 2019 21:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888636; bh=+x+XccsgLC72FddcFcYE+icmwrl+wXBNOtor5imuc/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ecsfsJghBuvtV2TD1FklRfqcD952aqs5rXZ2vmlKiBpzG303RgFeeLWrBEFOLdg+2 VIYd8nMuZFooz6uUIDRgWz4lS0zuiae4dGEGGfQiYZK5fR2SmUjtDjsVZPUXLNov/K FzDlXc1I/eCtKB0jPnoyDZx/hlrFhzOU/C3Dreyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chiranjeevi Rapolu , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 211/306] media: ov13858: Check for possible null pointer Date: Wed, 27 Nov 2019 21:31:01 +0100 Message-Id: <20191127203130.540872040@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chiranjeevi Rapolu [ Upstream commit 35629182eb8f931b0de6ed38c0efac58e922c801 ] Check for possible null pointer to avoid crash. Signed-off-by: Chiranjeevi Rapolu Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/ov13858.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index 0e7a85c4996c7..afd66d243403b 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -1612,7 +1612,8 @@ static int ov13858_init_controls(struct ov13858 *ov13858) OV13858_NUM_OF_LINK_FREQS - 1, 0, link_freq_menu_items); - ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; + if (ov13858->link_freq) + ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; pixel_rate_max = link_freq_to_pixel_rate(link_freq_menu_items[0]); pixel_rate_min = link_freq_to_pixel_rate(link_freq_menu_items[1]); @@ -1635,7 +1636,8 @@ static int ov13858_init_controls(struct ov13858 *ov13858) ov13858->hblank = v4l2_ctrl_new_std( ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_HBLANK, hblank, hblank, 1, hblank); - ov13858->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; + if (ov13858->hblank) + ov13858->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; exposure_max = mode->vts_def - 8; ov13858->exposure = v4l2_ctrl_new_std( -- 2.20.1