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: 163697 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp657637ilr; Thu, 9 May 2019 01:22:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnWXQmtLQFdEr+VQ+MwansgzYaJcD/YRKhpeUq1NH+ox0qBBXNr5X2q52vf0+cSVGNt4N4 X-Received: by 2002:a65:5106:: with SMTP id f6mr3740865pgq.253.1557390158782; Thu, 09 May 2019 01:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557390158; cv=none; d=google.com; s=arc-20160816; b=nZoA4rlnyXpCCpEA3JeJ/aXTuMHOGi1yH4k5RN1ksqhgv+8brpDIAvDnZn5TbxL1BE PT3HZ3fFHqsodjpRBMw3ikLvG7crDdR7dSkSzHVLbzO8pips3QkfQM1NgX27+aEolU2n 9EUi2fUKxNj6hRMvTQ3SwyD8KM6/RA33+fi3fQlbwpJq9zDYKPJdOQTp/XS/y09KeI9s ZOL9xDXeOXWUbGrjj/usQ595R7xKT9zyvUIqcJRCQcVbT9pqCgl7xMNnqzTrxZvqdY8s B/lszqVHpwNyQVJDvBChJ2Yemvz51uhRnJ/5hZVlBpCKiQuE/A5sK643j45QLjxynG2K u6Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=YTf10QKM0IWfV6mVPjjKGNVVLpNoCkDPl5RATbdY4ek=; b=sHZUWymURYAtYJkUCpKzKcnWNlM96TCF5R8a8TADvQj4bNLqK4krlGV5asQsHG5Hnl 76T+fMeASBkW+JiYh5vqY5Nky/aeUT0g32MvpWSFTBGv7zm7yG9gH59SYrvEM/gEUamI ctX9MIU8eUfh8zHa4IO+L+31z+MYKwy5OaIgmvzg/nF3vffiqNeRsoaJubeXzMlZW28F vI6ET/5MzfWWaLYu728sEIOucuMmAooyMBJb9qzm4lwr9S+rLnKPeU/WJLqrifGC5vYr Tr2bFTI2ZfH3E/X7zaSpnKD0eNzbWK5Wit4vJKzrfpsU0uoK53Wg+/MR8QCaijx3jwvK 7glg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id l82si1918916pfi.34.2019.05.09.01.22.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 May 2019 01:22:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com 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-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" 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 --- 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; }