gpu: nvgpu: Validate perfmon id count

Add a check against a too big perfmon id count.

Bug 200192125
Coverity ID 24285

Change-Id: I9b17081a1ea7243e6b57c0a95c59913cd8daf98b
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1132966
This commit is contained in:
Terje Bergstrom
2016-04-26 13:42:33 -07:00
parent dc08f78c57
commit 2d10b3c5ed

View File

@@ -662,6 +662,10 @@ int gr_gk20a_css_attach(struct gk20a *g,
if (!cs_client)
return -EINVAL;
if (!perfmon_count ||
perfmon_count > CSS_MAX_PERFMON_IDS - CSS_FIRST_PERFMON_ID)
return -EINVAL;
gr = &g->gr;
*cs_client = NULL;