Check for the minimum required buffer length in wlcore_cmd_send() and
wlcore_cmd_configure_failsafe.  This ensures that we will never try to
use a buffer that is smaller than the required header.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
                     id != CMD_STOP_FWLOGGER))
                return -EIO;
 
+       if (WARN_ON_ONCE(len < sizeof(*cmd)))
+               return -EIO;
+
        cmd = buf;
        cmd->id = cpu_to_le16(id);
        cmd->status = 0;
 
        wl1271_debug(DEBUG_CMD, "cmd configure (%d)", id);
 
+       if (WARN_ON_ONCE(len < sizeof(*acx)))
+               return -EIO;
+
        acx->id = cpu_to_le16(id);
 
        /* payload length, does not include any headers */