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]
Date: Mon, 1 Jul 2024 16:04:00 +0000
From: "Luck, Tony" <tony.luck@...el.com>
To: "Wieczor-Retman, Maciej" <maciej.wieczor-retman@...el.com>,
	"shuah@...nel.org" <shuah@...nel.org>, "Chatre, Reinette"
	<reinette.chatre@...el.com>, "Yu, Fenghua" <fenghua.yu@...el.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
	"ilpo.jarvinen@...ux.intel.com" <ilpo.jarvinen@...ux.intel.com>
Subject: RE: [PATCH v3 2/2] selftests/resctrl: Adjust SNC support messages

+static bool cpus_offline_empty(void)
+{
+	char offline_cpus_str[64];
+	FILE *fp;
+
+	fp = fopen("/sys/devices/system/cpu/offline", "r");

Check for fp == NULL before using it.

+	if (fscanf(fp, "%s", offline_cpus_str) < 0) {

fscanf() seems like a heavy hammer.

	if (fgets(offline_cpus_str, sizeof(offline_cpus_str), fp) == NULL) {
+		if (!errno) {

Don't need an errno check (seems dubious mixing errno with stdio).

+			fclose(fp);
+			return 1;

			return true;

+		}
+		ksft_perror("Could not read offline CPUs file!");
+	}
+
+	fclose(fp);
+
+	return 0;

	return false;
+}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ