From: Dan Carpenter <dan.carpenter@oracle.com>
To: tomeu.vizoso@collabora.com
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm/panfrost: Add sanity checks to submit IOCTL
Date: Tue, 7 May 2019 11:04:05 +0300 [thread overview]
Message-ID: <20190507080405.GA9436@mwanda> (raw)
Hello Tomeu Vizoso,
The patch 6ff408e6dc20: "drm/panfrost: Add sanity checks to submit
IOCTL" from Apr 24, 2019, leads to the following static checker
warning:
drivers/gpu/drm/panfrost/panfrost_drv.c:222 panfrost_ioctl_submit()
error: we previously assumed 'sync_out' could be null (see line 216)
drivers/gpu/drm/panfrost/panfrost_drv.c
168 static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
169 struct drm_file *file)
170 {
171 struct panfrost_device *pfdev = dev->dev_private;
172 struct drm_panfrost_submit *args = data;
173 struct drm_syncobj *sync_out = NULL;
174 struct panfrost_job *job;
175 int ret = 0;
176
177 if (!args->jc)
178 return -EINVAL;
179
180 if (args->requirements && args->requirements != PANFROST_JD_REQ_FS)
181 return -EINVAL;
182
183 if (args->out_sync > 0) {
184 sync_out = drm_syncobj_find(file, args->out_sync);
185 if (!sync_out)
186 return -ENODEV;
187 }
188
189 job = kzalloc(sizeof(*job), GFP_KERNEL);
190 if (!job) {
191 ret = -ENOMEM;
192 goto fail_out_sync;
193 }
194
195 kref_init(&job->refcount);
196
197 job->pfdev = pfdev;
198 job->jc = args->jc;
199 job->requirements = args->requirements;
200 job->flush_id = panfrost_gpu_get_latest_flush_id(pfdev);
201 job->file_priv = file->driver_priv;
202
203 ret = panfrost_copy_in_sync(dev, file, args, job);
204 if (ret)
205 goto fail_job;
206
207 ret = panfrost_lookup_bos(dev, file, args, job);
208 if (ret)
209 goto fail_job;
210
211 ret = panfrost_job_push(job);
212 if (ret)
213 goto fail_job;
214
215 /* Update the return sync object for the job */
216 if (sync_out)
^^^^^^^^
I'm pretty sure this can be removed.
217 drm_syncobj_replace_fence(sync_out, job->render_done_fence);
218
219 fail_job:
220 panfrost_job_put(job);
221 fail_out_sync:
222 drm_syncobj_put(sync_out);
^^^^^^^^
Otherwise we are toasted...
223
224 return ret;
225 }
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2019-05-07 11:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 8:04 Dan Carpenter [this message]
2019-05-09 8:21 ` [PATCH] drm/panfrost: Only put sync_out if non-NULL Tomeu Vizoso
2019-05-09 16:22 ` Steven Price
2019-05-13 14:56 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190507080405.GA9436@mwanda \
--to=dan.carpenter@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.