update_engine: Initialize kernel_max_rollforward to infinity on init

Currently the value of kernel_max_rollforward is set only after a successful
update check, but if the update is not successful or there was never an explicit
update check (test devices or bring up devices), this value is not set and it
can case incorrect firmware behavior. This CL initializes the value to infinity,
if the device is detected to be a consumer device, on update_engine
initialization.

BUG=chromium:900002
TEST=unittests
TEST=changed the value of kernel_max_rollforward and restart update_engine, the
value changed to infinity.

Change-Id: I1a2c905b5f5d5c10e71d055e31896f2838320fc0
Reviewed-on: https://chromium-review.googlesource.com/1405456
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Zentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/real_system_state.cc b/real_system_state.cc
index f576c6c..9474741 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -184,6 +184,17 @@
     return false;
   }
 
+  // For devices that are not rollback enabled (ie. consumer devices),
+  // initialize max kernel key version to 0xfffffffe, which is logically
+  // infinity.
+  if (policy_provider_.IsConsumerDevice()) {
+    if (!hardware()->SetMaxKernelKeyRollforward(
+            chromeos_update_manager::kRollforwardInfinity)) {
+      LOG(ERROR) << "Failed to set kernel_max_rollforward to infinity for"
+                 << " consumer devices";
+    }
+  }
+
   // All is well. Initialization successful.
   return true;
 }