aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-check
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2025-01-17 10:28:16 +0100
committerDmitry Vyukov <dvyukov@google.com>2025-01-17 10:02:07 +0000
commit5d04aae8969f6c72318ce0a4cde4f027766b1a55 (patch)
tree8f1b632847c431407090f0fe1335522ff2195a37 /tools/syz-check
parentf9e07a6e597b68d3397864e6ee4550f9065c3518 (diff)
all: use min/max functions
They are shorter, more readable, and don't require temp vars.
Diffstat (limited to 'tools/syz-check')
-rw-r--r--tools/syz-check/check.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/tools/syz-check/check.go b/tools/syz-check/check.go
index 6a0b4378b..f42512c02 100644
--- a/tools/syz-check/check.go
+++ b/tools/syz-check/check.go
@@ -726,7 +726,7 @@ func attrSize(policy nlaPolicy) (int, int, int) {
return -1, -1, -1
}
-func typeMinMaxValue(payload prog.Type) (min, max uint64, ok bool) {
+func typeMinMaxValue(payload prog.Type) (minVal, maxVal uint64, ok bool) {
switch typ := payload.(type) {
case *prog.ConstType:
return typ.Val, typ.Val, true
@@ -736,16 +736,12 @@ func typeMinMaxValue(payload prog.Type) (min, max uint64, ok bool) {
}
return 0, ^uint64(0), true
case *prog.FlagsType:
- min, max := ^uint64(0), uint64(0)
+ minVal, maxVal := ^uint64(0), uint64(0)
for _, v := range typ.Vals {
- if min > v {
- min = v
- }
- if max < v {
- max = v
- }
+ minVal = min(minVal, v)
+ maxVal = max(maxVal, v)
}
- return min, max, true
+ return minVal, maxVal, true
}
return 0, 0, false
}