From 2c2337a293dfcd7a144996048e48c2a54b44c5f8 Mon Sep 17 00:00:00 2001 From: Evan Ralston Date: Mon, 6 Feb 2017 11:44:21 -0800 Subject: [PATCH] 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 --- liblog/logd_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liblog/logd_reader.c b/liblog/logd_reader.c index 99d7fea3b..e09872cfa 100644 --- a/liblog/logd_reader.c +++ b/liblog/logd_reader.c @@ -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) {