Skip to content

Commit

Permalink
drm/gma500: Replace deprecated strncpy() with strscpy()
Browse files Browse the repository at this point in the history
strncpy() is deprecated for NUL-terminated destination buffers. Use
strscpy() instead and remove the manual NUL-termination.

Compile-tested only.

Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250225203932.334123-1-thorsten.blum@linux.dev
  • Loading branch information
Thorsten Blum authored and Patrik Jakobsson committed Mar 6, 2025
1 parent f83a9b8 commit ce43cf3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/gpu/drm/gma500/cdv_intel_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,7 @@ cdv_intel_dp_i2c_init(struct gma_connector *connector,

memset(&intel_dp->adapter, '\0', sizeof (intel_dp->adapter));
intel_dp->adapter.owner = THIS_MODULE;
strncpy (intel_dp->adapter.name, name, sizeof(intel_dp->adapter.name) - 1);
intel_dp->adapter.name[sizeof(intel_dp->adapter.name) - 1] = '\0';
strscpy(intel_dp->adapter.name, name);
intel_dp->adapter.algo_data = &intel_dp->algo;
intel_dp->adapter.dev.parent = connector->base.kdev;

Expand Down

0 comments on commit ce43cf3

Please sign in to comment.