From patchwork Mon Jul 22 16:08:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 11052911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42D2C13B1 for ; Mon, 22 Jul 2019 16:08:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3250228421 for ; Mon, 22 Jul 2019 16:08:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26A762857F; Mon, 22 Jul 2019 16:08:49 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY 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 B8A7728421 for ; Mon, 22 Jul 2019 16:08:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE25689CB5; Mon, 22 Jul 2019 16:08:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 125AC89CB5 for ; Mon, 22 Jul 2019 16:08:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id BFD4628AE09 From: Ezequiel Garcia To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 1/2] modetest: Fix segmentation fault Date: Mon, 22 Jul 2019 13:08:22 -0300 Message-Id: <20190722160823.26668-1-ezequiel@collabora.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ezequiel Garcia , rohan.garg@collabora.com, Emil Velikov Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When a mode is set with just a connector "-s foo", we get a nasty segmentation fault. Fix it. Signed-off-by: Ezequiel Garcia --- tests/modetest/modetest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index e66be6607e00..5e628127a130 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -1695,6 +1695,8 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg) return -1; /* Parse the remaining parameters. */ + if (!endp) + return -1; if (*endp == '@') { arg = endp + 1; pipe->crtc_id = strtoul(arg, &endp, 10);