From 0aeae321dc1a4ba12574e39811db01f7287fd0bc Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 16 Jul 2016 15:39:19 +0900 Subject: [PATCH] EON Steel: fix uninitialized field cache entries The check for whether we had initialized a field in the EON Steel cache data structure was wrong, causing some entries to be returned successfully even if their field had never been initialized. In most cases, it didn't matter, since the cache data was initialized to zero (which is a fine default for uninitialized data), so most of the time it didn't matter. But for the recently added dive mode field, this caused OC dives to be returned as freedives, for example. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- src/suunto_eonsteel_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/suunto_eonsteel_parser.c b/src/suunto_eonsteel_parser.c index 0fb05f6..c11719a 100644 --- a/src/suunto_eonsteel_parser.c +++ b/src/suunto_eonsteel_parser.c @@ -975,7 +975,7 @@ suunto_eonsteel_parser_get_field(dc_parser_t *parser, dc_field_type_t type, unsi suunto_eonsteel_parser_t *eon = (suunto_eonsteel_parser_t *)parser; - if (!(eon->cache.initialized >> type)) + if (!(eon->cache.initialized & (1 << type))) return DC_STATUS_UNSUPPORTED; switch (type) {