From patchwork Wed Oct 19 08:27:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212969wrs; Wed, 19 Oct 2022 02:08:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZSCYeTJe4+GjdDY++4PKoPCoFkdElIewHn98GL1TRWhvzAmV2aKSBV937HaNAbQSsqb5Y X-Received: by 2002:a17:907:3f23:b0:78e:260a:fc33 with SMTP id hq35-20020a1709073f2300b0078e260afc33mr5981940ejc.152.1666170529751; Wed, 19 Oct 2022 02:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170529; cv=none; d=google.com; s=arc-20160816; b=sDCsglXMmsULDBxKTrDelWfFoknGrRpCUY7OM28BXNb2yGKBVlc5py2hL9Tze7c5Je FfLm6ZAwxoptPVEp4hbZb1Ermw8KkAyVseHzjrJ+DT12RTjE8QafsfUO49/EafD0iqpX SgbYJNDNjEGzq/LVy382kNx8hG3HKNJvCLAc/3OuXNgNMSGEfrllKX5ZOnXUO7xHycro 9govPoXsC9JcXxE4uYpxoI/5wp2yLnRHkOSQKlgBADE++viVAINI5eekMX9FmqRkI7O6 vbetJED78YSM7HRzk0kpbL72F337eddPFqI0AP9NIeZsos+DXh1mQ8MDiqA//YqwvZG1 o75w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=krJBN5/BmQpwW44WhkmjdCPYneucenoWHe7kuMHkqoY=; b=gFpZZqvlXgMBgSV/3Qj5Sjp914T4eJsfzcLHRC/zsH/NcUPblhIcpJbtG3IZwcCcAn Nj0rq0YGtZACE63YNMwbfPs6SAdO04g6ir8rxCHr9Lh22B2UhorVL4OusT039w2Ig/aD 9dQYns06BWx0dZNOE6x6SKy8ZuxjEkkmuM/49FnUl/03sMrzxO0YdLs3Z5INTqlZDViF efXfiWrvfb8f3jxLlBCWoLajVImvdBtyUb4TrrzcZynjoIL4dNg8zsLDlFFzZvGVDq/Q kx8z6/Fe9uvyiPZigCkrqkZAx8ojd9jhcAziHdovKhAwEcKbpdWt0ljxsS5v3Z6gk30G sQ3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uskLR9Pp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b0078ddc074afdsi10693260ejc.577.2022.10.19.02.08.10; Wed, 19 Oct 2022 02:08:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uskLR9Pp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232206AbiJSJDL (ORCPT + 99 others); Wed, 19 Oct 2022 05:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232265AbiJSJBf (ORCPT ); Wed, 19 Oct 2022 05:01:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C61AC8E0E8; Wed, 19 Oct 2022 01:55:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8EA13617E8; Wed, 19 Oct 2022 08:54:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A164FC433D6; Wed, 19 Oct 2022 08:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169656; bh=C1rwG8z2GfL29LvFgqELgKitE9ciVJlqDiNdRtp24lY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uskLR9PpRwBmdDUryxzBYZrn1AgMU2WmV2Ly73iF9bFE4BeedQ9yDKkBayLBZ4ZqH 75Ngbqi+reJWgWbThZhOUdmOf/gkASwFIfKVjpW4gfs2LCV4Hi/pU5Q65ZfAik2aLg nxTcRKQCoPNkwyJhlouwad8wVycDPN+UXv4aNOcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Ser , Lyude Paul , Benjamin Gaignard , Jani Nikula , Sasha Levin Subject: [PATCH 6.0 358/862] drm/dp_mst: fix drm_dp_dpcd_read return value checks Date: Wed, 19 Oct 2022 10:27:25 +0200 Message-Id: <20221019083305.822247722@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106429426952796?= X-GMAIL-MSGID: =?utf-8?q?1747106429426952796?= From: Simon Ser [ Upstream commit 2ac6cdd581f48c8f68747156fde5868486a44985 ] drm_dp_dpcd_read returns the number of bytes read. The previous code would print garbage on DPCD error, and would exit with on error on success. Signed-off-by: Simon Ser Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings") Cc: Lyude Paul Cc: Benjamin Gaignard Reviewed-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/473500/ Signed-off-by: Sasha Levin --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index 57e65423e50d..7a94a5288e8d 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -4907,14 +4907,14 @@ void drm_dp_mst_dump_topology(struct seq_file *m, seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2); - if (ret) { + if (ret != 2) { seq_printf(m, "faux/mst read failed\n"); goto out; } seq_printf(m, "faux/mst: %*ph\n", 2, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1); - if (ret) { + if (ret != 1) { seq_printf(m, "mst ctrl read failed\n"); goto out; } @@ -4922,7 +4922,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, /* dump the standard OUI branch header */ ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE); - if (ret) { + if (ret != DP_BRANCH_OUI_HEADER_SIZE) { seq_printf(m, "branch oui read failed\n"); goto out; }