MCPcopy
hub / github.com/containerd/containerd / safeSum

Function safeSum

internal/userns/idmap.go:145–151  ·  view source on GitHub ↗

safeSum returns the sum of x and y. or an error if the result overflows

(x, y uint32)

Source from the content-addressed store, hash-verified

143
144// safeSum returns the sum of x and y. or an error if the result overflows
145func safeSum(x, y uint32) (uint32, error) {
146 z := x + y
147 if z < x || z < y {
148 return invalidID, errors.New("ID overflow")
149 }
150 return z, nil
151}
152
153// serializeLinuxIDMapping marshals a LinuxIDMapping object to string
154func serializeLinuxIDMapping(m specs.LinuxIDMapping) string {

Callers 1

toHostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…