diff --git a/ipu-plugin/pkg/ipuplugin/bridgeport_test.go b/ipu-plugin/pkg/ipuplugin/bridgeport_test.go index 2119b15..75dd9e9 100644 --- a/ipu-plugin/pkg/ipuplugin/bridgeport_test.go +++ b/ipu-plugin/pkg/ipuplugin/bridgeport_test.go @@ -107,7 +107,7 @@ var _ = Describe("bridgeport", Serial, func() { }, } fakePortBridgeInfo := &types.BridgePortInfo{ - fakePort, "fakePort1", + fakePort, 10, } fakeReq := &pb.CreateBridgePortRequest{BridgePort: fakePort} @@ -131,7 +131,7 @@ var _ = Describe("bridgeport", Serial, func() { }, } fakePortBridgeInfo := &types.BridgePortInfo{ - fakePort, "fakePort1", + fakePort, 10, } ipuServer.Ports["fakePort"] = fakePortBridgeInfo // fakePort already exists in internal Map diff --git a/ipu-plugin/pkg/ipuplugin/ipuplugin.go b/ipu-plugin/pkg/ipuplugin/ipuplugin.go index 125f619..d65479d 100644 --- a/ipu-plugin/pkg/ipuplugin/ipuplugin.go +++ b/ipu-plugin/pkg/ipuplugin/ipuplugin.go @@ -17,6 +17,7 @@ package ipuplugin import ( "context" "fmt" + "math" "net" "os" "os/signal" @@ -156,6 +157,12 @@ func AddAccApfsToGroupOne() error { return fmt.Errorf("error decoding hex: %v", err) } + // Check bounds before converting to uint + if hexVal < 0 || hexVal > math.MaxInt64 { + log.Errorf("hex value out of range: %v", hexVal) + return fmt.Errorf("hex value out of range: %v", hexVal) + } + vsiGroupInit := 0x8000050000000000 + uint(hexVal) vsiGroupWrite := 0xA000050000000000 + uint(hexVal)