Bug Description
In pkg/ibm/ibmz_helpers.go, the function checkIfIpIsLive has a missing return statement after a failed net.ResolveTCPAddr call. When DNS resolution fails, the error is logged but execution continues to line 86, where server.Network() and server.String() are called on a nil *net.TCPAddr, causing a panic.
Location
File: pkg/ibm/ibmz_helpers.go
Function: checkIfIpIsLive (line 78)
Bug location: lines 83-86
Current Code
server, err := net.ResolveTCPAddr("tcp", ip+":22")
if err != nil {
log.Error(err, "failed to resolve ip address")
}
conn, err := net.DialTimeout(server.Network(), server.String(), 5*time.Second)
Expected Behavior
When net.ResolveTCPAddr returns an error, the function should return that error immediately instead of proceeding to use the nil server pointer.
Impact
Any DNS resolution failure for an IBM Z or IBM Power host IP address will crash the controller with a nil pointer dereference panic rather than returning a clean error to the caller.
Suggested Fix
Add return err after the error log on line 84, matching the error-handling pattern used elsewhere in the same function (see lines 89 and 93).
Bug Description
In
pkg/ibm/ibmz_helpers.go, the functioncheckIfIpIsLivehas a missingreturnstatement after a failednet.ResolveTCPAddrcall. When DNS resolution fails, the error is logged but execution continues to line 86, whereserver.Network()andserver.String()are called on a nil*net.TCPAddr, causing a panic.Location
File:
pkg/ibm/ibmz_helpers.goFunction:
checkIfIpIsLive(line 78)Bug location: lines 83-86
Current Code
Expected Behavior
When
net.ResolveTCPAddrreturns an error, the function should return that error immediately instead of proceeding to use the nilserverpointer.Impact
Any DNS resolution failure for an IBM Z or IBM Power host IP address will crash the controller with a nil pointer dereference panic rather than returning a clean error to the caller.
Suggested Fix
Add
return errafter the error log on line 84, matching the error-handling pattern used elsewhere in the same function (see lines 89 and 93).