From patchwork Fri Nov 17 04:47:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ying Liu X-Patchwork-Id: 10062303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 849FB6023A for ; Fri, 17 Nov 2017 06:20:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D9592A9B3 for ; Fri, 17 Nov 2017 06:20:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6236A2A9C5; Fri, 17 Nov 2017 06:20:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CFF072A9B3 for ; Fri, 17 Nov 2017 06:20:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 763E36E269; Fri, 17 Nov 2017 06:20:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 5575 seconds by postgrey-1.35 at gabe; Fri, 17 Nov 2017 06:20:42 UTC Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0051.outbound.protection.outlook.com [104.47.36.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D37D6E269 for ; Fri, 17 Nov 2017 06:20:42 +0000 (UTC) Received: from BN6PR03CA0060.namprd03.prod.outlook.com (10.173.137.22) by MWHPR03MB2701.namprd03.prod.outlook.com (10.168.207.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Fri, 17 Nov 2017 04:47:45 +0000 Received: from BY2FFO11FD038.protection.gbl (2a01:111:f400:7c0c::108) by BN6PR03CA0060.outlook.office365.com (2603:10b6:404:4c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Fri, 17 Nov 2017 04:47:44 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=gmail.com; nvidia.com; dkim=none (message not signed) header.d=none; nvidia.com; dmarc=fail action=none header.from=gmail.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 192.88.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD038.mail.protection.outlook.com (10.1.14.223) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Fri, 17 Nov 2017 04:47:44 +0000 Received: from victor.ap.freescale.net (victor.ap.freescale.net [10.192.241.62]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vAH4leaJ024361; Thu, 16 Nov 2017 21:47:41 -0700 From: Liu Ying To: Subject: [PATCH libdrm] tests: kms: screen probe: Get screen mode when con->count_modes is nonzero Date: Fri, 17 Nov 2017 12:47:28 +0800 Message-ID: <1510894048-3715-1-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131553676643155808; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7966004)(336005)(39860400002)(346002)(376002)(39380400002)(2980300002)(189002)(199003)(36756003)(106466001)(50466002)(76482006)(86362001)(61266001)(47776003)(48376002)(6916009)(6666003)(2351001)(105596002)(33646002)(8936002)(77096006)(2906002)(82202002)(8676002)(189998001)(356003)(83322999)(81156014)(73392002)(81166006)(73972006)(50986999)(87572001)(81442002)(4326008)(5003940100001)(5660300001)(68736007)(97736004)(53936002)(55446002)(104016004)(316002)(498600001)(305945005)(16586007)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2701; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD038; 1:HkmkDShMwEFRJACv7GrcV3yxCNdLdZJL7oc9jsZSsOJPY9qGq8/c0cosRfq11YkKfmww8JbSMNNvFEszHgp7/4LLZhr0tpe0yINqcuTaO/WJhfX8kfFK6ebm177JZ5gW MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 767cca0d-8204-4e10-3458-08d52d76579a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:MWHPR03MB2701; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 3:DYvSMD1PrWuwbu7U0hIUbCO+NbsZBXyKkHhymua4S7rmAHsTv8+ZLSMIk2QhiJ0toLlIhlL+xUdT0kShQ+z3vO0h1RdqKDSX9LXn3PjvVsD7yiHKa4q73NWMxTX+eb6aGB49IlC69kwDBA2FZR7RdetBWs4VqQ1hZ6S2nanMFYskwg37+m3aW/QAWpYzoZl8rXo5GedPe9Gmj5Nyknd3JBr0xsB+MkogMFqD7uVhAE8Xwe2CdTMgBKkSUE4YFvDaRgfnS9XSJar+59aR5GUVcnqKTo3/PzWTLizbsI/UUDOadIV56QF5auObv/fCA1sGLVazJKX4TbQ9/o1Lg2rN+WDwOavdxlMpo+2ARApUBWw=; 25:gIStqln7az8IugGVuCeDp03/p8jlxkemiYpsEMmBzsl/L/FRtyEi9becXh/rZZy2Mva+t3hZqSFoCXUEvKhEvXXOrpGmcT8sgCArbBM3VBLkVn+Rcgu8ofro9uyZZbIMSZFLJim+snilWj/g17/RxBjvYw5VcHBDSpX+flEUKNnG8BXx9uEyYGCTPpT5kM05TBxSZP1uQTQHfwlmiV9+TGMca+i4V0l5EWiw2stVxCIyqpyuQVdNFZViIgdZdMMMp/R/0ZeXRbPH/KQBBP662VcqdZfPZdaiJBvw4SXGqmGxBVOeijOgHspf9wn4cVDkepcxUA53fE58hElNiKLyWQ== X-MS-TrafficTypeDiagnostic: MWHPR03MB2701: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 31:5RgVgQGSDQUm28hhXoujQmh+kGLSQSK5UD3Fg9EEFvFONFZT3HGy+89GsOFyTLy9XQ66kRoUMTQpNooaWNq4F5iogGAdLoPysIMVjruNasuOP6zlvCenF42WDztNFx7AkzKhS0uK3ZFnUAYXzZCao/FAHNM1/urKmdrHWKVfpn+okJl6rdBbrrEjPWEAXtmC+L2gLtz7DmFWMmb3k/xpLruUqByTXhbZCHEUQ2Ykv/M=; 4:5Ccn5ogmtZOH+hgi7JYPrRxWIGsG84jFHty2FBkU2wVpzwtDAfW2oMLzFEW0z4mswRO0Y4gx4KlSznTs3r70TCFfkCYFavuO35DK02raYhcy3vxqcE0DINHtI6MlS/VbZgFxEerr7zJMB19uiuwjKyCyDaTFfFgQD1WsnGZINzv1H7I/2SZZ3jtBvvLELJ3ezSpzDcqFoqxLyMR+ff5i94V0ac6OAboxMH6GdkXHhhFrMekIyFPW7Jvek5x+mXKOoLjf0WUGtpC1wZpflAHSJg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3231022)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123559100)(20161123556025)(20161123565025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123561025)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR03MB2701; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR03MB2701; X-Forefront-PRVS: 049486C505 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2701; 23:KFJ7CLRsooGwVqBzuth6Rb/cdGaeprhyczYIIEzaT?= =?us-ascii?Q?i4p+rqpyyj0YnPigO8pdw/pItOz4nqIL/DgE3/jRUXwlZJBkZnj8YVuiE4Ao?= =?us-ascii?Q?TVyhG566TOEn3e2E1Lezh/9DYbpPWBS6Oy9coE7H6zGXaiyHIFlTMg9ouV8o?= =?us-ascii?Q?w+Ja/bF/ikr4NJ2Fk/K6OHlTMOPSgZDR4BE74pucH9IfPrHuDRi9iQBPzVDI?= =?us-ascii?Q?HeSW7ORzDAzxkZNOGCWKRu8CwctnA+prXTYJz80C8Mw1pelik9yJA//313/3?= =?us-ascii?Q?AdpYv7goE/ZugehrvQvwC/viaT8DPtjHSShxCEbzh9U7klPFt30l1ct5wxRE?= =?us-ascii?Q?0V39ppHKHUQxKLHRktIRwc0qzHJqWhSANYRoXvD08XQebdYgQbN/l+Z9MTRA?= =?us-ascii?Q?ULuDCbsPkc0+fBSaDo0cXqloGjlS62a18un+OGzx3AdFEVSFARZoBxX/QtVf?= =?us-ascii?Q?2nQrlIj4v54F+l8Xb6pYEMwWF6ff1H+peYxSjecpkUQ8ccWTNCRe/8TCnWlV?= =?us-ascii?Q?DW2paAL9Fsnqga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yi6D/WJKlhF5NvHZUqbszNT1QzjhqIu2RZgERciibvmc/hbAuPsxTyzSZEaqek0dXr6eJutKjp+kPtdkd1/DXdEgr1xbpHHfAnfAX3Wx/2ERgbyvNeAyb6T719yfwTXrpmhz73rsK465am4f8G292n3s=; 5:naic8WbwSwqrUSeKzg/C080aFk1Jyfb7wc45rEQuJgLU98gLhyqwAa84rs3bOlKl5C67TV0PFuuxH/Mr8T2G7JdaNB0UNZ6LVAElShByQ2JetyB17+SSKVwzxuBu/Rp02cx0Nlxm/7G3E54Aei1eQ0HGt1zk2C1u+BBmhkud2ak=; 24:PGwIq2ZQ72Y59cvuDanfBhwINZFu1CcCAzJX8YTWpxuDflkgQLo1JjF7TdROZ2dGK5NEQ6LkP6KGSJnvKzvrLZucE1ZcfQZA9bRjGC/+YVA=; 7:b0BZcNctte7GJfyL5bvBpE+yV0EwDCwgrHkbGsKFAvtbwStBm5T0nuJX+DcMgvtWiN+vHLW1gmw4dFpCVu8IcUaubR+T046W+10JDCi5USuk1m9guc/ZUdAQnNUV2wxWY/s+ChDxx56Wzg7PvYZr/4XZjJ+b1SUa4TQEB5LoFIPpEx/ystENl80rmF8ExAcDsV4/mILeS5XiHKq+fXkzPPzlwlyxz+Rd1EC3EEH8+GzFQXrgNkEhhnsPbGBo0ubU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2017 04:47:44.0035 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 767cca0d-8204-4e10-3458-08d52d76579a X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2701 Cc: Thierry Reding X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We should not get screen mode when a connector has no modes, but just leave it be zero. This may avoid the segmentation fault issue when a connector status is disconnected, which is caused by memory copying from a NULL connector mode pointer to a screen mode. Signed-off-by: Liu Ying --- tests/kms/libkms-test-screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/kms/libkms-test-screen.c b/tests/kms/libkms-test-screen.c index 3369022..9ecf032 100644 --- a/tests/kms/libkms-test-screen.c +++ b/tests/kms/libkms-test-screen.c @@ -46,7 +46,8 @@ static void kms_screen_probe(struct kms_screen *screen) else screen->connected = false; - memcpy(&screen->mode, &con->modes[0], sizeof(drmModeModeInfo)); + if (con->count_modes) + memcpy(&screen->mode, &con->modes[0], sizeof(drmModeModeInfo)); screen->width = screen->mode.hdisplay; screen->height = screen->mode.vdisplay;