lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fbb8ab5fd566369cc47e9f23b9f4ac25dde009b8.1750245955.git.shravankr@nvidia.com>
Date: Wed, 18 Jun 2025 07:39:47 -0400
From: Shravan Kumar Ramani <shravankr@...dia.com>
To: Ilpo Jarvinen <ilpo.jarvinen@...ux.intel.com>, Vadim Pasternak
	<vadimp@...dia.com>, David Thompson <davthompson@...dia.com>
CC: Shravan Kumar Ramani <shravankr@...dia.com>,
	<platform-driver-x86@...r.kernel.org>, <linux-kernel@...r.kernel.org>, "David
 Thompson" <davthomspson@...dia.com>
Subject: [PATCH v2 1/2] platform/mellanox: mlxbf-pmc: Replace strcmp with strncmp

Since the input string passed via the command line appends a newline char,
comparison using strcmp is not correct. Use the string length of the
event_list entries to match the string using strncmp instead.

Fixes: 1a218d312e65 ("platform/mellanox: mlxbf-pmc: Add Mellanox BlueField PMC driver")
Signed-off-by: Shravan Kumar Ramani <shravankr@...dia.com>
Reviewed-by: David Thompson <davthomspson@...dia.com>
---
 drivers/platform/mellanox/mlxbf-pmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
index 900069eb186e..366c0cba447f 100644
--- a/drivers/platform/mellanox/mlxbf-pmc.c
+++ b/drivers/platform/mellanox/mlxbf-pmc.c
@@ -1215,7 +1215,7 @@ static int mlxbf_pmc_get_event_num(const char *blk, const char *evt)
 		return -EINVAL;
 
 	for (i = 0; i < size; ++i) {
-		if (!strcmp(evt, events[i].evt_name))
+		if (!strncmp(evt, events[i].evt_name, strlen(events[i].evt_name)))
 			return events[i].evt_num;
 	}
 
-- 
2.30.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ