Skip to content

Commit

Permalink
fix: codeQL fix
Browse files Browse the repository at this point in the history
Signed-off-by: atulpatel261194 <Atul.Patel@intel.com>
  • Loading branch information
atulpatel261194 committed Sep 3, 2024
1 parent c460b12 commit 4458367
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -672,18 +672,18 @@ func _deleteTcamEntry(vrfID uint32, direction int) ([]interface{}, uint32) {
// PhyPort structure of phy ports
type PhyPort struct {
id int
vsi int
vsi uint16
mac string
}

// PhyPortInit initializes the phy port
func (p PhyPort) PhyPortInit(id int, vsi string, mac string) PhyPort {
p.id = id
val, err := strconv.ParseInt(vsi, 10, 32)
val, err := strconv.ParseUint(vsi, 10, 16)
if err != nil {
panic(err)
}
p.vsi = int(val)
p.vsi = uint16(val)
p.mac = mac

return p
Expand Down Expand Up @@ -711,18 +711,18 @@ func _p2pQid(pID int) int {

// GrpcPairPort structure
type GrpcPairPort struct {
vsi int
vsi uint16
mac string
peer map[string]string
}

// GrpcPairPortInit get the vsi+16
func (g GrpcPairPort) GrpcPairPortInit(vsi string, mac string) GrpcPairPort {
val, err := strconv.ParseInt(vsi, 10, 32)
val, err := strconv.ParseUint(vsi, 10, 16)
if err != nil {
panic(err)
}
g.vsi = int(val)
g.vsi = uint16(val)
g.mac = mac
return g
}
Expand Down Expand Up @@ -1328,7 +1328,7 @@ func (l L3Decoder) StaticAdditions() []interface{} {
},
)
for _, port := range l._grpcPorts {
var peerVsi, err = strconv.ParseInt(port.peer["vsi"], 10, 64)
var peerVsi, err = strconv.ParseUint(port.peer["vsi"], 10, 16)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -1358,7 +1358,7 @@ func (l L3Decoder) StaticAdditions() []interface{} {
},
Action: p4client.Action{
ActionName: "linux_networking_control.l2_fwd",
Params: []interface{}{uint32(_toEgressVsi(port.vsi))},
Params: []interface{}{uint32(_toEgressVsi(int(port.vsi)))},
},
})
}
Expand Down Expand Up @@ -1388,7 +1388,7 @@ func (l L3Decoder) StaticAdditions() []interface{} {
},
Action: p4client.Action{
ActionName: "linux_networking_control.fwd_to_port",
Params: []interface{}{uint32(_toEgressVsi(port.vsi))},
Params: []interface{}{uint32(_toEgressVsi(int(port.vsi)))},
},
},
p4client.TableEntry{
Expand Down

0 comments on commit 4458367

Please sign in to comment.