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.

thermal: intel: int340x: Use symbolic constant for UUID comparison

Replace sizeof() with a symbolic constant for UUID matching to maintain
existing ABI behavior while improving code clarity. The current behavior
of comparing only the first 7 characters is sufficient to distinguish
all UUIDs and changing to full string comparison would alter the kernel
ABI, potentially breaking existing userspace applications.

Use a defined constant to make the truncated comparison explicit and
maintainable.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
[ rjw: Subject adjustments ]
Link: https://patch.msgid.link/20251030035955.62171-1-kaushlendra.kumar@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Kaushlendra Kumar and committed by
Rafael J. Wysocki
90199078 966c9e65

+3 -1
+3 -1
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
··· 16 16 #define INT3400_ODVP_CHANGED 0x88 17 17 #define INT3400_KEEP_ALIVE 0xA0 18 18 #define INT3400_FAKE_TEMP (20 * 1000) /* faked temp sensor with 20C */ 19 + /* UUID prefix length for comparison - sufficient for all UUIDs */ 20 + #define INT3400_UUID_PREFIX_LEN 7 19 21 20 22 enum int3400_thermal_uuid { 21 23 INT3400_THERMAL_ACTIVE = 0, ··· 201 199 202 200 for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; ++i) { 203 201 if (!strncmp(buf, int3400_thermal_uuids[i], 204 - sizeof(int3400_thermal_uuids[i]) - 1)) { 202 + INT3400_UUID_PREFIX_LEN)) { 205 203 /* 206 204 * If we have a list of supported UUIDs, make sure 207 205 * this one is supported.