shearwater: properly initialize the string caches

The merge with Jef's upstream ended up taking a lot of Jef's changes to
how the Shearwater PNF parsing was done, and in the process inadvertdly
lost some of the code from our side of the branch that Jef hadn't taken.

In particular, the initialization of the string cache, and the
logversion string.

Put them back.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2019-01-23 13:28:39 +13:00
parent 391c4095f2
commit 072bef1666

View File

@ -442,6 +442,7 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
if (parser->cached) {
return DC_STATUS_SUCCESS;
}
memset(parser->strings, 0, sizeof(parser->strings));
// Verify the minimum length.
if (size < 2) {
@ -577,6 +578,7 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
// Log versions before 6 weren't reliably stored in the data, but
// 6 is also the oldest version that we assume in our code
unsigned int logversion = data[parser->opening[4] + (pnf ? 16 : 127)];
add_string_fmt(parser, "Logversion", "%d%s", logversion, pnf ? "(PNF)" : "");
// The transmitter battery levels are only valid for logversion 7+
if (logversion < 7) {