gpu: nvgpu: Add check for chip name size

When copying chip name to GPU characteristics limit the size of copy
to the size of target name field.

Coverity ID 33613

Change-Id: Ia538d47b9d5e1dd122d57ccd8bfbb3902612874c
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1172007
This commit is contained in:
Terje Bergstrom
2016-06-27 12:48:33 -07:00
parent 1b04326f40
commit 6a7b85527e

View File

@@ -2135,7 +2135,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
gpu->as_ioctl_nr_last = NVGPU_AS_IOCTL_LAST;
gpu->gpu_va_bit_count = 40;
memcpy(gpu->chipname, g->ops.name, strlen(g->ops.name));
strlcpy(gpu->chipname, g->ops.name, sizeof(gpu->chipname));
gpu->max_fbps_count = g->ops.gr.get_max_fbps_count(g);
gpu->fbp_en_mask = g->ops.gr.get_fbp_en_mask(g);
gpu->max_ltc_per_fbp = g->ops.gr.get_max_ltc_per_fbp(g);