From patchwork Thu May 9 08:21:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 10936859 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 720A2933 for ; Thu, 9 May 2019 08:22:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 632A4288E0 for ; Thu, 9 May 2019 08:22:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 573DF289A7; Thu, 9 May 2019 08:22:39 +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 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 F1C9A288E0 for ; Thu, 9 May 2019 08:22:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6D7B89A57; Thu, 9 May 2019 08:22:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id C0CEF89A57 for ; Thu, 9 May 2019 08:22:36 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id s18so3637597wmh.0 for ; Thu, 09 May 2019 01:22:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DPrdW9+2z6ZUxmiIwYAl4ynBRRcGa0YhreGJjxJguQ0=; b=NKmADvHXwQepw3KMQKRoVYi64Eh3AdrhvL7VuTrKp9eibKavwVqpUsOiErJjlqcmJ5 W/nD4QZboaeXR9KkxuW5x+VK1U1J4ALrolOj+J2i2O+Wzl/GQ7/V9Vu5w24npjLH2FzK hZBrzehxpzo67hvH+vnIELvQQ+fFPaqCSTbBtuMpdQa7ZI/fOnySsXSQt+A+jw8mQBOr McMkSJ7ZKJJasATed+RxwxxdKA9Te9qFJKeT1D/uYw2BZkZqw90/DTJhtJPyCYxIc8Ik whpJ/490sJL4KxpNJCdQjggJ839r4CW9xzjsRzPFbiMbTOcC0DC9YWyOTCggu5MEIilS isLg== X-Gm-Message-State: APjAAAXp9DMHYmC0yeGDxXpluWz5Cqk0ZEGepKJPRHFCQf8u8NxqA2nC fgriHBNwEBMcQ18p8ObWux3kvyrR X-Google-Smtp-Source: APXvYqwuVBrRYXA/qgWO+V/oJ48tgq/iYoF8W2SZh0ogr8u9IBBsUqPCV7b8QNgavEqkxzXlJ7sGDw== X-Received: by 2002:a1c:9942:: with SMTP id b63mr1905051wme.116.1557390155439; Thu, 09 May 2019 01:22:35 -0700 (PDT) Received: from cizrna.lan ([109.72.12.206]) by smtp.gmail.com with ESMTPSA id v189sm2519556wma.3.2019.05.09.01.22.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 May 2019 01:22:34 -0700 (PDT) From: Tomeu Vizoso To: LKML Subject: [PATCH] drm/panfrost: Only put sync_out if non-NULL Date: Thu, 9 May 2019 10:21:51 +0200 Message-Id: <20190509082151.8823-1-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190507080405.GA9436@mwanda> References: <20190507080405.GA9436@mwanda> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DPrdW9+2z6ZUxmiIwYAl4ynBRRcGa0YhreGJjxJguQ0=; b=QmPLQVvj57rGV5eY/pOEbo6GIUkWcw6d9oUOE7QHLnfcdKoxk2KqjtiWRImeUGIcm5 0Up9IGbrN8JuEE8ypnd21uvPQHk4dqJ6WPaiqM7nqzxEmqSfRh2+ugnjDB6Oj8ZagY8a W7I2bhppa6pXaRfOnkdG8In9Sj1j6Xy1iGERi4GTtU2RxOcexjX1LEkB6EhnUTmwAFzC wllilfkp2qkpEdYLzPFRPKTur7Gu2fDxEaOzBfDFJUINzM+wSxF9kAIAbCLXuolSwlmF fAyLBnF7zhkDv0IIBUXgdTexqDQ0bF0VbontWfZX/jZ6LjTfnbSA2aK/5Is0lBlj8uif vIfA== 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: Tomeu Vizoso , David Airlie , dri-devel@lists.freedesktop.org, Dan Carpenter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Dan Carpenter's static analysis tool reported: drivers/gpu/drm/panfrost/panfrost_drv.c:222 panfrost_ioctl_submit() error: we previously assumed 'sync_out' could be null (see line 216) Indeed, sync_out could be NULL if userspace doesn't send a sync object ID for the out fence. Signed-off-by: Tomeu Vizoso Reported-by: Dan Carpenter Link: https://lists.freedesktop.org/archives/dri-devel/2019-May/217014.html Reviewed-by: Steven Price --- drivers/gpu/drm/panfrost/panfrost_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 94b0819ad50b..d11e2281dde6 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -219,7 +219,8 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data, fail_job: panfrost_job_put(job); fail_out_sync: - drm_syncobj_put(sync_out); + if (sync_out) + drm_syncobj_put(sync_out); return ret; }