Merge "Cleanup for #inclusivefixit."

This commit is contained in:
Treehugger Robot 2020-07-28 09:46:41 +00:00 committed by Gerrit Code Review
commit ab89a928d1
7 changed files with 16 additions and 17 deletions

View file

@ -607,7 +607,7 @@ static void tune_metadata_csum(const std::string& blk_device, const FstabEntry&
LINFO << "Enabling ext4 metadata_csum on " << blk_device;
// requires to give last_fsck_time to current to avoid insane time.
// Must give `-T now` to prevent last_fsck_time from growing too large,
// otherwise, tune2fs won't enable metadata_csum.
const char* tune2fs_args[] = {TUNE2FS_BIN, "-O", "metadata_csum,64bit,extent",
"-T", "now", blk_device.c_str()};

View file

@ -994,7 +994,7 @@ void CreateSerializedPropertyInfo() {
&property_infos)) {
return;
}
// Don't check for failure here, so we always have a sane list of properties.
// Don't check for failure here, since we don't always have all of these partitions.
// E.g. In case of recovery, the vendor partition will not have mounted and we
// still need the system / platform properties to function.
if (access("/system_ext/etc/selinux/system_ext_property_contexts", R_OK) != -1) {

View file

@ -54,7 +54,7 @@ class InitKillServicesTest : public ::testing::TestWithParam<std::string> {};
TEST_P(InitKillServicesTest, KillCriticalProcesses) {
ExpectKillingServiceRecovers(GetParam());
// sanity check init is still responding
// Ensure that init is still responding
EXPECT_TRUE(SetProperty("test.death.test", "asdf"));
EXPECT_EQ(GetProperty("test.death.test", ""), "asdf");
EXPECT_TRUE(SetProperty("test.death.test", ""));

View file

@ -456,7 +456,6 @@ bool __android_logger_property_get_bool(const char* key, int flag) {
flag |= BOOL_DEFAULT_FLAG_SVELTE;
}
/* Sanity Check */
if (flag & (BOOL_DEFAULT_FLAG_SVELTE | BOOL_DEFAULT_FLAG_ENG)) {
flag &= ~BOOL_DEFAULT_FLAG_TRUE_FALSE;
flag |= BOOL_DEFAULT_TRUE;
@ -613,4 +612,4 @@ int __android_log_is_debuggable() {
return 1;
}
#endif
#endif

View file

@ -616,15 +616,15 @@ int Logcat::Run(int argc, char** argv) {
if (long_options[option_index].name == wrap_str) {
mode |= ANDROID_LOG_WRAP | ANDROID_LOG_NONBLOCK;
// ToDo: implement API that supports setting a wrap timeout
size_t dummy = ANDROID_LOG_WRAP_DEFAULT_TIMEOUT;
if (optarg && (!ParseUint(optarg, &dummy) || dummy < 1)) {
size_t timeout = ANDROID_LOG_WRAP_DEFAULT_TIMEOUT;
if (optarg && (!ParseUint(optarg, &timeout) || timeout < 1)) {
error(EXIT_FAILURE, 0, "%s %s out of range.",
long_options[option_index].name, optarg);
}
if (dummy != ANDROID_LOG_WRAP_DEFAULT_TIMEOUT) {
if (timeout != ANDROID_LOG_WRAP_DEFAULT_TIMEOUT) {
fprintf(stderr, "WARNING: %s %u seconds, ignoring %zu\n",
long_options[option_index].name, ANDROID_LOG_WRAP_DEFAULT_TIMEOUT,
dummy);
timeout);
}
break;
}

View file

@ -381,8 +381,8 @@ pid_t LogKlog::sniffPid(const char*& buf, ssize_t len) {
}
if ((i == 9) && (cp[i] == ' ')) {
int pid = 0;
char dummy;
if (sscanf(cp + 4, "%d%c", &pid, &dummy) == 2) {
char placeholder;
if (sscanf(cp + 4, "%d%c", &pid, &placeholder) == 2) {
buf = cp + 10; // skip-it-all
return pid;
}
@ -392,8 +392,8 @@ pid_t LogKlog::sniffPid(const char*& buf, ssize_t len) {
// Mediatek kernels with modified printk
if (*cp == '[') {
int pid = 0;
char dummy;
if (sscanf(cp, "[%d:%*[a-z_./0-9:A-Z]]%c", &pid, &dummy) == 2) {
char placeholder;
if (sscanf(cp, "[%d:%*[a-z_./0-9:A-Z]]%c", &pid, &placeholder) == 2) {
return pid;
}
break; // Only the first one
@ -703,7 +703,7 @@ int LogKlog::log(const char* buf, ssize_t len) {
p = " ";
b = 1;
}
// paranoid sanity check, can not happen ...
// This shouldn't happen, but clamp the size if it does.
if (b > LOGGER_ENTRY_MAX_PAYLOAD) {
b = LOGGER_ENTRY_MAX_PAYLOAD;
}
@ -712,7 +712,7 @@ int LogKlog::log(const char* buf, ssize_t len) {
}
// calculate buffer copy requirements
ssize_t n = 1 + taglen + 1 + b + 1;
// paranoid sanity check, first two just can not happen ...
// Extra checks for likely impossible cases.
if ((taglen > n) || (b > n) || (n > (ssize_t)USHRT_MAX) || (n <= 0)) {
return -EINVAL;
}
@ -722,7 +722,7 @@ int LogKlog::log(const char* buf, ssize_t len) {
// If we malloc'd this buffer, we could get away without n's USHRT_MAX
// test above, but we would then required a max(n, USHRT_MAX) as
// truncating length argument to logbuf->log() below. Gain is protection
// of stack sanity and speedup, loss is truncated long-line content.
// against stack corruption and speedup, loss is truncated long-line content.
char newstr[n];
char* np = newstr;

View file

@ -139,7 +139,7 @@ TEST(propertyinfoserializer, GetPropertyInfo) {
auto property_info_area = reinterpret_cast<const PropertyInfoArea*>(serialized_trie.data());
// Sanity check
// Smoke test
auto root_node = property_info_area->root_node();
EXPECT_STREQ("root", root_node.name());
EXPECT_STREQ("default", property_info_area->context(root_node.context_index()));