ipmi: promote min length check to earlier

Most of the commands (if not all) require some minimum length for the
request.  Therefore, to save on duplicating the request minimum length
check in every command, it's now checked ahead of calling into the
command handler.

Change-Id: I3710a6bf39a631b06547327b90610a38cb674d23
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/main.cpp b/main.cpp
index 9b78f77..7a22923 100644
--- a/main.cpp
+++ b/main.cpp
@@ -44,7 +44,13 @@
         return IPMI_CC_INVALID;
     }
 
-    uint8_t subCmd = reqBuf[0];
+    auto subCmd = static_cast<FlashSubCmds>(reqBuf[0]);
+
+    /* Validate the minimum request length for the command. */
+    if (!validateRequestLength(subCmd, *dataLen))
+    {
+        return IPMI_CC_INVALID;
+    }
 
     /* TODO: This could be cleaner to just have a function pointer table, may
      * transition in later patchset.