Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp736998ybc; Sat, 16 Nov 2019 07:49:37 -0800 (PST) X-Google-Smtp-Source: APXvYqw9quz18gvNPKJrGPGtcV4FtCJqRHWr+u78nQfBuRCx8wcBnssKfr3C0c7aRHAClyNWPkRG X-Received: by 2002:a17:906:970a:: with SMTP id k10mr10353511ejx.314.1573919377727; Sat, 16 Nov 2019 07:49:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573919377; cv=none; d=google.com; s=arc-20160816; b=dsaLQdn8XkzT2pfshDD7wa9AGs0YSAxMe2YiyDUiXOcsL4eVUMgAkWepjK0RFofRXz z82jw5oIj1tZNeKyry5e9JeyMZHxODtCESelVo4ohXmM6slMQHBHwog5DlK+pf/c8nGk bEvS7jXl5jtUajbogu9mLMda5pxwW40ci/4yc3n1wxMyjJPJNWmbndBo5PI38GZuxfYn YHml+ma3bQy1sXTuOsBuX540oLXex/3ZoxqzQCcG8virYDXYaEDboBCZoHeZTF28WcnI HzsUXexHTdysXyavjxGS05bLbqKivjjDlz/O8s11kyQFb0/ka4vgwrbVVJlW9NHX4olC RKhg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PfhobJToGdd72bBpIlq6dQxTYWieDEUNqAqrT0ZvEHs=; b=1BiJI0rXwuBJI9Ar60Hr2FNbCU1tZUbyF27IOqihMPSo6/SUDxC1uxS70Afo/wN+7q Kf0QTPryx7MdMupFdnZARZ0lENstPqNCcY6imRX4tU4REy/77RQS3aotFfW5m9TuOgtC 0hyZEh1piUYPJ0eaBzQwl+GCkIZ4ZrHGn0g353QBYoYpDefg9uD4L6KVuQ+PmjLyne2v kVaSqXK5T16KGj3n1wCWA4VWyyQ4mrImZybkb81/XDQ6DnKpNq0VLNZAqUrrYoNHcjlc ER3+YZpURaHzF8nXPZyVKVaSE7LLI4Q11zTHzrbs/KYR3UAajfxVnm8Ck6GTI9dj8VBQ oOHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OcNZg48p; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dc21si8276688ejb.101.2019.11.16.07.49.13; Sat, 16 Nov 2019 07:49:37 -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=OcNZg48p; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729587AbfKPPrB (ORCPT + 99 others); Sat, 16 Nov 2019 10:47:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:52788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729388AbfKPPq1 (ORCPT ); Sat, 16 Nov 2019 10:46:27 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4209020830; Sat, 16 Nov 2019 15:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919186; bh=yztD/eG3vMr/Rvs0vWXMhNLFKFHrlrDPs/mf4F4zuqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OcNZg48p29k8GoM2Khl9YjEd//n+fJqNjaoIt+SERnq0j2y6b3aVCY4Dy91wRwhcr uHS3c3HG4QUW1PMEAqJnbeY64T/df9eHYn2Pjyhd5tghl1tH5ztGstyr7vDEMn1wb4 mk9CE51HQgljxU7YxeJOTfmoG89ZHL9QNxVe60f8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chiranjeevi Rapolu , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 194/237] media: ov13858: Check for possible null pointer Date: Sat, 16 Nov 2019 10:40:29 -0500 Message-Id: <20191116154113.7417-194-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 a66f6201f53c7..cf28381a903e3 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