diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2015-02-25 07:45:15 -0500 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-04-04 21:08:42 -0400 |
commit | cdbe8d1fc123c93a0bbf0bf329a3f8f94ac8c2fa (patch) | |
tree | e354d8666c32185d62adca7d39d227fb68673c15 /drivers | |
parent | 91a388564dd9baed5e7257709fb109af79fdadcf (diff) |
gpu: nvgpu: use correct API to check valid syncpt
Below check assumes that available syncpt range
starts from 0
id >= nvhost_syncpt_nb_pts_ext()
Instead of using this API, use nvhost_syncpt_is_valid_pt_ext()
which validates the syncpt id against both upper and lower
boundaries
Bug 1611482
Change-Id: I7c4465a2bc84b63fefaa17c64f02582885924c5e
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/711211
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index 631813ae..73b2d7ec 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * GK20A Channel Synchronization Abstraction | 4 | * GK20A Channel Synchronization Abstraction |
5 | * | 5 | * |
6 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | 6 | * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms and conditions of the GNU General Public License, | 9 | * under the terms and conditions of the GNU General Public License, |
@@ -61,7 +61,7 @@ static int gk20a_channel_syncpt_wait_syncpt(struct gk20a_channel_sync *s, | |||
61 | container_of(s, struct gk20a_channel_syncpt, ops); | 61 | container_of(s, struct gk20a_channel_syncpt, ops); |
62 | struct priv_cmd_entry *wait_cmd = NULL; | 62 | struct priv_cmd_entry *wait_cmd = NULL; |
63 | 63 | ||
64 | if (id >= nvhost_syncpt_nb_pts_ext(sp->host1x_pdev)) { | 64 | if (!nvhost_syncpt_is_valid_pt_ext(sp->host1x_pdev, id)) { |
65 | dev_warn(dev_from_gk20a(sp->c->g), | 65 | dev_warn(dev_from_gk20a(sp->c->g), |
66 | "invalid wait id in gpfifo submit, elided"); | 66 | "invalid wait id in gpfifo submit, elided"); |
67 | return 0; | 67 | return 0; |
@@ -105,8 +105,8 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd, | |||
105 | for (i = 0; i < sync_fence->num_fences; i++) { | 105 | for (i = 0; i < sync_fence->num_fences; i++) { |
106 | struct sync_pt *pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt); | 106 | struct sync_pt *pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt); |
107 | u32 wait_id = nvhost_sync_pt_id(pt); | 107 | u32 wait_id = nvhost_sync_pt_id(pt); |
108 | if (!wait_id || | 108 | if (!wait_id || !nvhost_syncpt_is_valid_pt_ext(sp->host1x_pdev, |
109 | wait_id >= nvhost_syncpt_nb_pts_ext(sp->host1x_pdev)) { | 109 | wait_id)) { |
110 | sync_fence_put(sync_fence); | 110 | sync_fence_put(sync_fence); |
111 | return -EINVAL; | 111 | return -EINVAL; |
112 | } | 112 | } |