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-next>] [day] [month] [year] [list]
Message-Id: <20210803173619.91539-1-pmalani@chromium.org>
Date:   Tue,  3 Aug 2021 10:36:19 -0700
From:   Prashant Malani <pmalani@...omium.org>
To:     linux-kernel@...r.kernel.org
Cc:     Prashant Malani <pmalani@...omium.org>,
        Benson Leung <bleung@...omium.org>,
        Enric Balletbo i Serra <enric.balletbo@...labora.com>,
        Guenter Roeck <groeck@...omium.org>
Subject: [PATCH v2 1/2] platform/chrome: cros_ec_proto: Update feature check

EC feature flags now require more than 32 bits to be represented. In
order to make cros_ec_check_features() usable for more recent features,
update it to account for the extra 32 bits of features.

Signed-off-by: Prashant Malani <pmalani@...omium.org>
---
Changes in v2:
- No changes.

 drivers/platform/chrome/cros_ec_proto.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index a7404d69b2d3..772edad80593 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -813,6 +813,7 @@ EXPORT_SYMBOL(cros_ec_get_host_event);
 int cros_ec_check_features(struct cros_ec_dev *ec, int feature)
 {
 	struct cros_ec_command *msg;
+	u32 mask;
 	int ret;
 
 	if (ec->features[0] == -1U && ec->features[1] == -1U) {
@@ -839,7 +840,12 @@ int cros_ec_check_features(struct cros_ec_dev *ec, int feature)
 		kfree(msg);
 	}
 
-	return ec->features[feature / 32] & EC_FEATURE_MASK_0(feature);
+	if (feature >= 32)
+		mask = EC_FEATURE_MASK_1(feature);
+	else
+		mask = EC_FEATURE_MASK_0(feature);
+
+	return ec->features[feature / 32] & mask;
 }
 EXPORT_SYMBOL_GPL(cros_ec_check_features);
 
-- 
2.32.0.554.ge1b32706d8-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ