From 3a039ff76350811822b3ab885c64c683016da879 Mon Sep 17 00:00:00 2001 From: Xin Li Date: Wed, 9 Jan 2019 15:15:15 -0800 Subject: [PATCH] Fix compile time warning. In checkIncidentPermissions(), the intention of code is to bail out when the caller do not have appropriate permission. Logically, DEST_LOCAL and DEST_EXPLICIT should be checked separately. In the current code, we would fall-through to DEST_EXPLICIT case, but because permitted DEST_LOCAL callers (AID_SHELL and AID_ROOT) are also permitted DEST_EXPLICIT callers, we will still get the Status:ok(). Test: build Change-Id: I0f6121cb1aba7724306b99469f5ef97b4358ac7d --- cmds/incidentd/src/IncidentService.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp index e305b5462b777..80e6b9b66f4ac 100644 --- a/cmds/incidentd/src/IncidentService.cpp +++ b/cmds/incidentd/src/IncidentService.cpp @@ -82,6 +82,7 @@ static Status checkIncidentPermissions(const IncidentReportArgs& args) { Status::EX_SECURITY, "Calling process does not have permission to get local data."); } + break; case DEST_EXPLICIT: if (callingUid != AID_SHELL && callingUid != AID_ROOT && callingUid != AID_STATSD && callingUid != AID_SYSTEM) { @@ -91,6 +92,7 @@ static Status checkIncidentPermissions(const IncidentReportArgs& args) { Status::EX_SECURITY, "Calling process does not have permission to get explicit data."); } + break; } return Status::ok(); }