Check against LOG_ID_MAX instead of LOG_ID_KERNEL

Logd currently checks against LOG_ID_KERNEL to determine if a given
log_id is available. While this matches with the comments in log.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 with log buffers with id's
greater than LOG_ID_KERNEL and liblog reports that logd is unavailable
while logd would accept the request.

Test: compiles. no functional change

Change-Id: I0302d9e3f2657706fdf778f1e78e5604abf566e2
This commit is contained in:
Evan Ralston 2017-02-06 11:44:21 -08:00
parent 9cd890e9b7
commit 2c2337a293

View file

@ -90,7 +90,7 @@ LIBLOG_HIDDEN struct android_log_transport_read logdLoggerRead = {
static int logdAvailable(log_id_t logId)
{
if (logId > LOG_ID_KERNEL) {
if (logId >= LOG_ID_MAX || logId == LOG_ID_KERNEL) {
return -EINVAL;
}
if (logId == LOG_ID_SECURITY) {