Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp513570pxa; Wed, 19 Aug 2020 07:39:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXYlesP2WaMO0K5k2mg55Ls5Kqfg4P5V1sqeueYcDI9jjWqYwzfjlNMLKVmGMLByesQmAG X-Received: by 2002:a17:906:7391:: with SMTP id f17mr7952996ejl.392.1597847966431; Wed, 19 Aug 2020 07:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597847966; cv=none; d=google.com; s=arc-20160816; b=hHBDoTUUo09H6zU5JMJ695ilO/iG78TvwRJVIHIgIoZ3qTMK3Godke2G0UcnxsdOBM SLo82cQeIKCWnZSe29oiTcuxECPllGz0wD1q7Z6WYlqKXXhBog6QWs5UoykU10VxmWTK TQiKQOijo/XUOnrerB4ArjMtfLpLEs4Q2AZfuZ7QhGK65o4omrr8At09aBTf9A//Rav6 MAQBiDq2P0pL+bV4jWaNKS0VIPknw2ZxZbUO2qg5fTrJT0UsFZYefssawwG3CrCY3nZt 00fElNMv7ldsnn+tONMf4vpIPVYud/w6dFOF+egSZmqYeDTiwL0aclTgSqnMOotUDIzH gBLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=1ds67YA6GTaKXcwcDTwdCYzSNRlAXvzKHUOUVhz1K1g=; b=SjV+vrv+oYKEtExa0PwhyHf+J3KaVZPjDF9+Fedm7REBKsRhDvjPvQS1r9r7yUvmqj SULP2XiwVuNwjxia+USDQxMlYVMuarm7HLOq9V8LdEZLrV9xBXDb6fa2umHBc7w/HzMu npcms0C0VdogVg2dqYFETWVcvNHCnuU+VUV8jrxFpf5FRcTQP4ybp3V5gMyj5eG9PsmB TZLDfcbf4EXJXOW7FIonbj2+5YhIu9kvDJZJoD5HRfZ+e5fKUuQsrARAxEnZS8wrhjfG cWtV+ddpauL91RQgjDblb03XMZH9SPj9HKVL+/GwMgOKxYBKytW/TzP4R7/ITAjKWOJp 60Rg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si15196682edq.44.2020.08.19.07.39.02; Wed, 19 Aug 2020 07:39:26 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728608AbgHSOiG (ORCPT + 99 others); Wed, 19 Aug 2020 10:38:06 -0400 Received: from mail.ispras.ru ([83.149.199.84]:58214 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbgHSOiE (ORCPT ); Wed, 19 Aug 2020 10:38:04 -0400 Received: from kleverstation.intra.ispras.ru (unknown [10.10.2.220]) by mail.ispras.ru (Postfix) with ESMTPS id 59B7440A206D; Wed, 19 Aug 2020 14:37:59 +0000 (UTC) From: Nadezda Lutovinova To: Peter Senna Tschudin Cc: Nadezda Lutovinova , Martin Donnelly , Martyn Welch , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] drm/brige/megachips: Add checking if ge_b850v3_lvds_init() is working correctly Date: Wed, 19 Aug 2020 17:37:56 +0300 Message-Id: <20200819143756.30626-1-lutovinova@ispras.ru> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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