Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86/intel/uncore-freq: Replace sprintf() with scnprintf()

Replace unbounded sprintf() calls with scnprintf() to prevent potential
buffer overflows when formatting device names. While the current format
strings cannot overflow the buffer, using scnprintf() follows kernel
best practices for string formatting.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Link: https://patch.msgid.link/20251230124516.229125-2-kaushlendra.kumar@intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Kaushlendra Kumar and committed by
Ilpo Järvinen
050a0aab 751e2ebf

+3 -2
+3 -2
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
··· 269 269 goto uncore_unlock; 270 270 271 271 data->instance_id = ret; 272 - sprintf(data->name, "uncore%02d", ret); 272 + scnprintf(data->name, sizeof(data->name), "uncore%02d", ret); 273 273 } else { 274 - sprintf(data->name, "package_%02d_die_%02d", data->package_id, data->die_id); 274 + scnprintf(data->name, sizeof(data->name), "package_%02d_die_%02d", 275 + data->package_id, data->die_id); 275 276 } 276 277 277 278 uncore_read(data, &data->initial_min_freq_khz, UNCORE_INDEX_MIN_FREQ);