[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260205234632.1964-1-iprintercanon@gmail.com>
Date: Thu, 5 Feb 2026 23:46:32 +0000
From: Artem Lytkin <iprintercanon@...il.com>
To: Marc Dietrich <marvin24@....de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: ac100@...ts.launchpad.net,
linux-tegra@...r.kernel.org,
linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Artem Lytkin <iprintercanon@...il.com>
Subject: [PATCH] staging: nvec: use strcmp() instead of strncmp() with magic length
Replace strncmp() with a hardcoded length of 30 with strcmp().
The bat_type string is already null-terminated (set two lines above),
so strncmp() with an arbitrary length is misleading and functionally
equivalent to strcmp().
Signed-off-by: Artem Lytkin <iprintercanon@...il.com>
---
drivers/staging/nvec/nvec_power.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/nvec/nvec_power.c b/drivers/staging/nvec/nvec_power.c
index 2faab9fde..89dd997aa 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -207,7 +207,7 @@ static int nvec_power_bat_notifier(struct notifier_block *nb,
* This differs a little from the spec fill in more if you find
* some.
*/
- if (!strncmp(power->bat_type, "Li", 30))
+ if (!strcmp(power->bat_type, "Li"))
power->bat_type_enum = POWER_SUPPLY_TECHNOLOGY_LION;
else
power->bat_type_enum = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
--
2.43.0
Powered by blists - more mailing lists