summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRolf Eike Beer <eb@emlix.com>2018-10-10 16:04:31 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-11-29 10:48:12 +0100
commit75d2637cbec81401d37305767939d53d9f409559 (patch)
treedd61beb978557eba1c0235447473ea0a624604bd /drivers
parenta05b96fea9971f3648b53824d97ccddb1a197267 (diff)
Tegra: fix potential one byte overflows when calling strncpy()
Causes build failures with gcc 8. Signed-off-by: Rolf Eike Beer <eb@emlix.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_allocator.c4
-rw-r--r--drivers/misc/tegra-profiler/auth.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
index 32c003b655a6..422670d43397 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
@@ -842,9 +842,9 @@ gk20a_allocator_constrain(struct gk20a_allocator *a,
int gk20a_allocator_init(struct gk20a_allocator *allocator,
const char *name, u32 start, u32 len, u32 align)
{
- memset(allocator, 0, sizeof(struct gk20a_allocator));
+ memset(allocator, 0, sizeof(*allocator));
- strncpy(allocator->name, name, 32);
+ strlcpy(allocator->name, name, sizeof(allocator->name));
allocator->block_cache =
kmem_cache_create(allocator->name,
diff --git a/drivers/misc/tegra-profiler/auth.c b/drivers/misc/tegra-profiler/auth.c
index 7a89ba57f33e..51141ad5fac0 100644
--- a/drivers/misc/tegra-profiler/auth.c
+++ b/drivers/misc/tegra-profiler/auth.c
@@ -256,7 +256,7 @@ int quadd_auth_is_debuggable(const char *package_name)
data->debug_app_uid = 0;
data->response_value = 0;
- strncpy(data->package_name, package_name, QUADD_MAX_PACKAGE_NAME);
+ strlcpy(data->package_name, package_name, sizeof(data->package_name));
mutex_unlock(&auth_ctx.lock);
request_ready();