From patchwork Sat Oct 22 07:23:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104905wrr; Sat, 22 Oct 2022 01:33:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DJaumRHAWrLBMUmAZ9esDy7c6QSLsur+dioUURwWNjdyWEOSkzxesFdhc0ReLkuS7nyD5 X-Received: by 2002:a17:903:2490:b0:17f:bf7e:c521 with SMTP id p16-20020a170903249000b0017fbf7ec521mr23149957plw.161.1666427620962; Sat, 22 Oct 2022 01:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427620; cv=none; d=google.com; s=arc-20160816; b=JV3a+FuQkntq3rR2Tg87p5DBNVU2tPUHoHWt6klUQoKr8BA1/cNO79NqAwqhkICEKx qKbqLWgpImjq2KlI3SfLt9Ee7G252qm8l5+qxlTt62Pkyt5ujwOPkvczl/UsvqXxyZ03 kgYKOlMGTec1D5xrPqGO66anixZTyCHVEUvIozQa4jStkMadVhY0KOQvBYpZ2MaQEojd kNXxLig66BgE7bQhhG/9CcVjgkCy9JOtjcBDXoY79SpFf96VT4YhcGwn+rs6hBZaXuVN S/cQHAxmh/kWsrTK+Nz2+Sa9OECIlsKVdymjM4vgXMEAV4oOitnbu/pjmrIlpCH9gMpx 57oQ== 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=wNNi9XRp9MXuI5jU68P8di+W1fIdMmIRSN+4FcevlEY=; b=VczYaNU4f+bZxS3PaSsP9w7i7whJGhCkZOGJS09pTD+ic9gxQmgrzFUvfmI7j49Ugo mEOx7keTJGrUuuZkAhnjEUo3Mip+5fmTb0VhCzYtrT8ou15Bi6RizP07DwUUzK3oqqGE zojEg4wZFUc15bcoLN/+ifN/aPKMHzcKCEV1jW3mLNTCOcoiZtdYIatNRn9bN2rx38yp +596Dm0hNBBtByyR9jbuFj0mnOZbzTGXOBDTeWay38hjt60J5a8e4vn+JOd3UlwmhvUO /u9uQZIqi0civb+0M3YOUgag0vVGQRLBy/mW7x5exXb4oLsBQHOlkRSYTfrOAlvYNg4z FDeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Yz/wxypv"; 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 38-20020a630d66000000b004616889d5c2si29305988pgn.495.2022.10.22.01.33.26; Sat, 22 Oct 2022 01:33:40 -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="Yz/wxypv"; 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 S233675AbiJVITE (ORCPT + 99 others); Sat, 22 Oct 2022 04:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233310AbiJVIQk (ORCPT ); Sat, 22 Oct 2022 04:16:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19D7CFF20A; Sat, 22 Oct 2022 00:57:33 -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 ams.source.kernel.org (Postfix) with ESMTPS id E4AE6B82DFE; Sat, 22 Oct 2022 07:47:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A4CEC433C1; Sat, 22 Oct 2022 07:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424857; bh=Vp52VCPyvK1uo9tqWME7V3/uLHnMjoZvQgmyVTyQAMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yz/wxypvxh9k7XoYZNbM4NAnmiI1ylJuujlR0akBjeXQrK2CjBljRyqGbN2feq44A z94UAqkUuU+ctabhyrVHLY1LWk+64e8llLRZ0DEM6gx+a+uqpBpy+41C+IzuPHxiZX 9i931XEDDRxqBw3rCUQpeelbPl8/A/sMH+Q+ZMpc= 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 5.19 303/717] drm/dp_mst: fix drm_dp_dpcd_read return value checks Date: Sat, 22 Oct 2022 09:23:02 +0200 Message-Id: <20221022072506.436381005@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376009505554978?= X-GMAIL-MSGID: =?utf-8?q?1747376009505554978?= 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 18f2b6075b78..28dd741f7da1 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -4916,14 +4916,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; } @@ -4931,7 +4931,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; }