gpu: nvgpu: Validate regops num_ops argument

Check that num_ops is not too big. We have a hard limit of 1 page
allocated for the operations.

Bug 200192125

Change-Id: I724039c9dd6e0e93d9df0f5b3a797158fdb5e687
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1132965
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Terje Bergstrom
2016-04-26 13:37:45 -07:00
parent 394545acf6
commit ad24c028db

View File

@@ -975,6 +975,9 @@ static int nvgpu_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s,
struct channel_gk20a *ch;
u64 ops_size = sizeof(ops[0]) * args->num_ops;
if (args->num_ops > SZ_4K / sizeof(ops[0]))
return -EINVAL;
gk20a_dbg_fn("%d ops, total size %llu", args->num_ops, ops_size);
if (!dbg_s->ops) {