Martin Mucha has posted comments on this change. Change subject: core: coverity issue fix. ......................................................................
Patch Set 1: (1 comment) http://gerrit.ovirt.org/#/c/31206/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/macpoolmanager/MacsStorage.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/macpoolmanager/MacsStorage.java: Line 64: final List<Long> result = new ArrayList<>(numberOfMacs); Line 65: int remainingMacs = numberOfMacs; Line 66: while (remainingMacs > 0) { Line 67: Line 68: /*this is not needed, rangeWithAvailableMac won't be null, unless there's an error for which NPE should be > 1. If it really is impossible for this to be null, then I would not change ad 1. Ok, I'll mark that to ignore. Look at methods getAvailableMacsCount and getRangeWithAvailableMac and precondition "getAvailableMacsCount() < numberOfMacs". Method getAvailableMacsCount iterates over all ranges asking for number of their available number of macs. If theres none range with available mac, zero sum is returned, precondition fails. And only in this case method "getRangeWithAvailableMac", iterating over all ranges getting one with available mac, will return null. But call to this is blocked by precondition. ad 2. you're right, trying to please coverity replaced hypothetical NPE with hypothetical infinite loop, where probability of occuring is 0 (now). It cannot happen (now), but it's definitely worse. Ignoring this CID is far better, was not aware of this option. Line 69: thrown, but Coverity detects dereferencing hypothetical null as a problem.*/ Line 70: final Range rangeWithAvailableMac = getRangeWithAvailableMac(); Line 71: if (rangeWithAvailableMac == null) { Line 72: continue; -- To view, visit http://gerrit.ovirt.org/31206 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id8a06231c6151530ff6c0fee9614b45f39c3a1dd Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha <[email protected]> Gerrit-Reviewer: Alona Kaplan <[email protected]> Gerrit-Reviewer: Lior Vernia <[email protected]> Gerrit-Reviewer: Martin Mucha <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
