From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE046C432C0 for ; Tue, 3 Dec 2019 10:31:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB47F205ED for ; Tue, 3 Dec 2019 10:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725838AbfLCKb3 (ORCPT ); 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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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