diff --git a/bpf/loader/NetBpfLoad.cpp b/bpf/loader/NetBpfLoad.cpp index 4c47f83bbf..dc0a548878 100644 --- a/bpf/loader/NetBpfLoad.cpp +++ b/bpf/loader/NetBpfLoad.cpp @@ -556,9 +556,9 @@ static int readCodeSections(ifstream& elfFile, vector& cs) { vector csSymNames; ret = getSectionSymNames(elfFile, oldName, csSymNames, STT_FUNC); if (ret || !csSymNames.size()) return ret; - for (size_t i = 0; i < progDefNames.size(); ++i) { - if (!progDefNames[i].compare(csSymNames[0] + "_def")) { - cs_temp.prog_def = pd[i]; + for (size_t j = 0; j < progDefNames.size(); ++j) { + if (!progDefNames[j].compare(csSymNames[0] + "_def")) { + cs_temp.prog_def = pd[j]; break; } } @@ -865,7 +865,7 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector& ALOGE("Failed to read .BTF section, ret:%d", ret); return ret; } - struct btf *btf = btf__new(btfData.data(), btfData.size()); + btf = btf__new(btfData.data(), btfData.size()); if (btf == NULL) { ALOGE("btf__new failed, errno: %d", errno); return -errno;