Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1149096ybl; Tue, 3 Dec 2019 02:32:13 -0800 (PST) X-Google-Smtp-Source: APXvYqwL41olLnkJuaIv0IbqT662LYvOofbk229EOf0k1zoy1LTM+0PsS8YbGYfMfntIVZgfMtSk X-Received: by 2002:aca:4ad1:: with SMTP id x200mr2827225oia.104.1575369133785; Tue, 03 Dec 2019 02:32:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575369133; cv=none; d=google.com; s=arc-20160816; b=zbuL72arVsN98dzTtvEtxxu8Ts7u7n+cuWifmVnkaUrrE1dZ4M78HkWlW24L6daD6r CHthqP54GjcRHB0IuCbRJguwqPRP0hVC11Y/y8uPAZtMd9h7QiqsCQh4eplyJ4SNp9M9 AQ8zw3hwBvOGJ1T6fgCa6a9bR9HUoLDmz/cu8M1j38qIu5XTxrtyGyGRqhlcxhhHTv3E OxV1WQEk3ya7Qqu1O6lFqoh78Q3113EAjM0Ap2f5kWK4kbcAZa9GUWWtIDl/gb/suWrz HILVli7cbCcSrNwucacLL/v8Q90HVmiRxHeljUuOmcP16LAE+hlO6oQQHWlj1CHeCbwn 59WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=HR4Z4cXZjlh+1Dpv4DXc1kkdgHJr0YR28480LfwnO+c=; b=HTYluxSYHvJInLINGxhGm6P07l4/8QRXmXQ33sY8vi3yUiTzsl/MOcsGrvdqJzitZj W9tu0MdwCTyypSyORrWbO4JFn6KYeoPdallkVb0+Kbkq5hlTMmzrksUKSZvWsEW0ioU/ EyfTsyEp+wlFnt1unUMUhWWlNsYbncvPPELpUr4+b/AAjQHGagxCdcZXUXZbxDxfhF/q NTiGcNyp9HYemaENay1mGD9CLzjgc7vOxf8veqHWRoJ/qMo4QziCx/LPddKlpN5sRv4x /se0Ze3pbbf/ELupqpv11rPmEbTiXSxRCkEaeFFf4yGJpwy8uzq4csr12Fxxqigi30AI 3b/A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l131si1067630oib.174.2019.12.03.02.32.01; Tue, 03 Dec 2019 02:32:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726323AbfLCKb3 (ORCPT + 99 others); Tue, 3 Dec 2019 05:31:29 -0500 Received: from mga09.intel.com ([134.134.136.24]:41774 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbfLCKb3 (ORCPT ); Tue, 3 Dec 2019 05:31:29 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 02:31:28 -0800 X-IronPort-AV: E=Sophos;i="5.69,272,1571727600"; d="scan'208";a="213367267" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 02:31:26 -0800 Received: by paasikivi.fi.intel.com (Postfix, from userid 1000) id 7E18E20976; Tue, 3 Dec 2019 12:31:23 +0200 (EET) Date: Tue, 3 Dec 2019 12:31:23 +0200 From: Sakari Ailus To: Pavel Machek Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Chiranjeevi Rapolu , Mauro Carvalho Chehab , Sasha Levin Subject: Re: [PATCH 4.19 211/306] media: ov13858: Check for possible null pointer Message-ID: <20191203103123.GA32127@paasikivi.fi.intel.com> References: <20191127203114.766709977@linuxfoundation.org> <20191127203130.540872040@linuxfoundation.org> <20191203102250.GA27320@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191203102250.GA27320@amd> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pavel, On Tue, Dec 03, 2019 at 11:22:50AM +0100, Pavel Machek wrote: > Hi! > > > From: Chiranjeevi Rapolu > > > > [ Upstream commit 35629182eb8f931b0de6ed38c0efac58e922c801 ] > > > > Check for possible null pointer to avoid crash. > > > 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 = > > I don't think this is right fix. If ov13858->link_freq initialization > fails, we want to fail the initialization, not present > half-initialized device to userland, no? The patch fixes the problem. The rest could be debated, but LMML is the right place for that debate. -- Regard,s Sakari Ailus