liblog: Harden log_id check.

Logd currently checks against LOG_ID_MAX and LOG_ID_KERNEL to
determine if a given log_id is available.  liblog uses only
LOG_ID_KERNEL.  While this matches with the comments in log/log_id.h
to always keep LOG_ID_KERNEL at the end it does not match with other
checks that logd makes, causing inconsistent behavior.  This
inconsistency is noticable on devices that errantly rewrite
LOG_ID_MAX to not equal LOG_ID_KERNEL + 1.  For log buffers with
id's greater than LOG_ID_KERNEL, liblog reports that logd is
unavailable while logd would accept the request.

The guideline is to not use buffer ids above LOG_ID_KERNEL.
This hardening change prevents an inconsistency that results if these
guidelines are not followed.  Partners are urged instead to increase
LOG_ID_KERNEL locally to match their LOG_ID_MAX - 1 when they add new
local log buffers in their private builds.

Signed-off-by: Evan Ralston <eralston@amazon.com>
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: compiles. no functional change
Change-Id: Icd4b12ac79c1e5cd1d8a32f67a9795797580aad5
diff --git a/liblog/logd_writer.c b/liblog/logd_writer.c
index 2bab92e..12b797d 100644
--- a/liblog/logd_writer.c
+++ b/liblog/logd_writer.c
@@ -117,7 +117,7 @@
 
 static int logdAvailable(log_id_t logId)
 {
-    if (logId > LOG_ID_SECURITY) {
+    if (logId >= LOG_ID_MAX || logId == LOG_ID_KERNEL) {
         return -EINVAL;
     }
     if (atomic_load(&logdLoggerWrite.context.sock) < 0) {