Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1584396pxa; Sun, 23 Aug 2020 08:26:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSjcl+qrZ5Htd6DgmpuqNKH2r2kZrz2u+Y0XmYysK3aukURDWn3w0PRguSksz3U9b+tKQV X-Received: by 2002:a17:906:2686:: with SMTP id t6mr1836730ejc.406.1598196381395; Sun, 23 Aug 2020 08:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598196381; cv=none; d=google.com; s=arc-20160816; b=qw+yKiar+xs4tBpJ5lFBqBAaFmCRqFZDK1yvUvmwuuGRTAIO/tyCxyRYfviApGMcvl WL5Vf7AA+vU1LtM/nc8eZV/gUo1O0zkzQPGD2EOBpw44HA0fSpVR3h2MbEA2XmPaXGOY ry0vMF72dLbEux2P2Co/Mh/bAmQI+P3rtCTE5ywux0ljKWBthnGwD4WH1USCYleV89Gf M9uPTG8z6MbWAYUsWI5xeHxB7eLEP6biPPjWIDz4DYfA0PVNeQiojy8tTNmi4RpB232J g4S5SeCI3CBUwzU4XMkAkc18IHjAMSAWMHhJWIC1bl+iTct8hRvd7d61R1AYYpAAbPVH QhdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JQfTAlfwA3Zg+fXl49cn0hismv/jcTTh9mZj/Q1UdVQ=; b=M9sdfGUYdwlxesOH5cwi8mO9kF5i9glPVXOIOjC5mmS9ZE9wf84tsVT+BQJhgpF0je uIZRF3Pq0IXznZ79tGR7qSwCM8m2rFlkLZjq659wDiSyDFStyC3PKUDZRPy0RF6TXuN2 gR7rBvhicqclUUoFBI42rAkRJMYHmvPgbo+ITeo7Rivy4o3SOIznAnkrOkDWgAuo2T5c 6Be08uuliX+IlhcajKE9BZUi//dprTfVsfNwFQmAVuRboqdWLHmeQy0givtGPig8CrxJ e0hvjjJJvmUZFhf7hfJThlQIiGIqjLG29S0aSaMDbcW4W+z4KpZeJbWR96qX7VVGpDrn 9Pyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si5387902edz.288.2020.08.23.08.25.58; Sun, 23 Aug 2020 08:26:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727860AbgHWPLI (ORCPT + 99 others); Sun, 23 Aug 2020 11:11:08 -0400 Received: from asavdk4.altibox.net ([109.247.116.15]:37040 "EHLO asavdk4.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726818AbgHWPLE (ORCPT ); Sun, 23 Aug 2020 11:11:04 -0400 Received: from ravnborg.org (unknown [188.228.123.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by asavdk4.altibox.net (Postfix) with ESMTPS id A05A880512; Sun, 23 Aug 2020 17:10:59 +0200 (CEST) Date: Sun, 23 Aug 2020 17:10:58 +0200 From: Sam Ravnborg To: Nadezda Lutovinova Cc: Peter Senna Tschudin , ldv-project@linuxtesting.org, Jernej Skrabec , Martyn Welch , Neil Armstrong , David Airlie , Jonas Karlman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Andrzej Hajda , Laurent Pinchart , Martin Donnelly Subject: Re: [PATCH] drm/brige/megachips: Add checking if ge_b850v3_lvds_init() is working correctly Message-ID: <20200823151058.GB1047718@ravnborg.org> References: <20200819143756.30626-1-lutovinova@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819143756.30626-1-lutovinova@ispras.ru> X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=aP3eV41m c=1 sm=1 tr=0 a=S6zTFyMACwkrwXSdXUNehg==:117 a=S6zTFyMACwkrwXSdXUNehg==:17 a=kj9zAlcOel0A:10 a=HH5vDtPzAAAA:8 a=xjQjg--fAAAA:8 a=e5mUnYsNAAAA:8 a=hQuFlIxVr7xEOWb3pwQA:9 a=CjuIK1q_8ugA:10 a=QM_-zKB-Ew0MsOlNKMB5:22 a=L4vkcYpMSA5nFlNZ2tk3:22 a=Vxmtnl_E_bksehYqCbjh:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nadezda On Wed, Aug 19, 2020 at 05:37:56PM +0300, Nadezda Lutovinova wrote: > If ge_b850v3_lvds_init() does not allocate memory for ge_b850v3_lvds_ptr, > then a null pointer dereference is accessed. > > The patch adds checking of the return value of ge_b850v3_lvds_init(). > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Nadezda Lutovinova Thanks, applied to drm-misc-next, so it will hit upstream during the next merge window. Sam > --- > drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c > index 6200f12..ab81748 100644 > --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c > +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c > @@ -302,8 +302,12 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, > const struct i2c_device_id *id) > { > struct device *dev = &stdp4028_i2c->dev; > + int ret; > + > + ret = ge_b850v3_lvds_init(dev); > > - ge_b850v3_lvds_init(dev); > + if (ret) > + return ret; > > ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; > i2c_set_clientdata(stdp4028_i2c, ge_b850v3_lvds_ptr); > @@ -361,8 +365,12 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, > const struct i2c_device_id *id) > { > struct device *dev = &stdp2690_i2c->dev; > + int ret; > + > + ret = ge_b850v3_lvds_init(dev); > > - ge_b850v3_lvds_init(dev); > + if (ret) > + return ret; > > ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c; > i2c_set_clientdata(stdp2690_i2c, ge_b850v3_lvds_ptr); > -- > 1.9.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel