From 6a7b85527e96f64e913137d79b66c90ff62124fe Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 27 Jun 2016 12:48:33 -0700 Subject: 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 Reviewed-on: http://git-master/r/1172007 --- drivers/gpu/nvgpu/gk20a/gk20a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 44ed4e51..2ca89e9f 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -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); -- cgit v1.2.2