From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Cc: rafael@kernel.org, rui.zhang@intel.com,
srinivas.pandruvada@linux.intel.com, daniel.lezcano@linaro.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v2] thermal: Use symbolic constant for UUID prefix comparison
Date: Wed, 12 Nov 2025 21:07:41 +0100 [thread overview]
Message-ID: <CAJZ5v0gSDfsnrnh0a8LaKv8+_RbarA-uemhRmv1c356Rx87ijw@mail.gmail.com> (raw)
In-Reply-To: <20251030035955.62171-1-kaushlendra.kumar@intel.com>
On Thu, Oct 30, 2025 at 5:02 AM Kaushlendra Kumar
<kaushlendra.kumar@intel.com> wrote:
>
> 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>
> ---
> Changes in v2:
> - Use symbolic constant instead of strlen() to maintain existing ABI
> behavior as review feedback
>
> drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index 908cc1bf57f1..128556632685 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -16,6 +16,8 @@
> #define INT3400_ODVP_CHANGED 0x88
> #define INT3400_KEEP_ALIVE 0xA0
> #define INT3400_FAKE_TEMP (20 * 1000) /* faked temp sensor with 20C */
> +/* UUID prefix length for comparison - sufficient for all UUIDs */
> +#define INT3400_UUID_PREFIX_LEN 7
>
> enum int3400_thermal_uuid {
> INT3400_THERMAL_ACTIVE = 0,
> @@ -199,7 +201,7 @@ static ssize_t current_uuid_store(struct device *dev,
>
> for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; ++i) {
> if (!strncmp(buf, int3400_thermal_uuids[i],
> - sizeof(int3400_thermal_uuids[i]) - 1)) {
> + INT3400_UUID_PREFIX_LEN)) {
> /*
> * If we have a list of supported UUIDs, make sure
> * this one is supported.
> --
Applied as 6.19 material, thanks!
prev parent reply other threads:[~2025-11-12 20:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 3:59 [PATCH v2] thermal: Use symbolic constant for UUID prefix comparison Kaushlendra Kumar
2025-11-12 20:07 ` Rafael J. Wysocki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJZ5v0gSDfsnrnh0a8LaKv8+_RbarA-uemhRmv1c356Rx87ijw@mail.gmail.com \
--to=rafael@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=kaushlendra.kumar@intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).