summaryrefslogtreecommitdiffstats
path: root/chrome_elf/blacklist
diff options
context:
space:
mode:
authorbrucedawson <brucedawson@chromium.org>2014-10-28 12:58:22 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-28 19:58:36 +0000
commit1fd77f5dac94f7bd887cfee74742e6894f14beac (patch)
treef702a86d6e15cfdf30d903ddd629f03dd011f0f4 /chrome_elf/blacklist
parent0eabca976cf66e07ec523083f25e17ad63d21cba (diff)
downloadchromium_src-1fd77f5dac94f7bd887cfee74742e6894f14beac.zip
chromium_src-1fd77f5dac94f7bd887cfee74742e6894f14beac.tar.gz
chromium_src-1fd77f5dac94f7bd887cfee74742e6894f14beac.tar.bz2
Fix two minor bugs found by /analyze
BUG=427616 /analyze pointed out that the loop range-check used the comma operator when && was probably intended. The bug was harmless, but confusing, so I fixed it. /analyze also pointed out that the code was checking data read by a function and then checking whether the read succeeded. Reversing the order of the checks has no effect except to get rid of the undefined behavior. Review URL: https://codereview.chromium.org/678193003 Cr-Commit-Position: refs/heads/master@{#301691}
Diffstat (limited to 'chrome_elf/blacklist')
-rw-r--r--chrome_elf/blacklist/blacklist.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc
index 6d78608..9915f6c 100644
--- a/chrome_elf/blacklist/blacklist.cc
+++ b/chrome_elf/blacklist/blacklist.cc
@@ -158,7 +158,7 @@ bool LeaveSetupBeacon() {
reinterpret_cast<LPBYTE>(&blacklist_state),
&blacklist_state_size);
- if (blacklist_state == BLACKLIST_DISABLED || result != ERROR_SUCCESS ||
+ if (result != ERROR_SUCCESS || blacklist_state == BLACKLIST_DISABLED ||
type != REG_DWORD) {
::RegCloseKey(key);
return false;
@@ -227,7 +227,7 @@ bool IsBlacklistInitialized() {
}
int GetBlacklistIndex(const wchar_t* dll_name) {
- for (int i = 0; i < kTroublesomeDllsMaxCount, g_troublesome_dlls[i]; ++i) {
+ for (int i = 0; i < kTroublesomeDllsMaxCount && g_troublesome_dlls[i]; ++i) {
if (_wcsicmp(dll_name, g_troublesome_dlls[i]) == 0)
return i;
}