Skip to content

Commit 8cc955a

Browse files
hiyonglizhiyongliz
and
hiyongliz
authored
Fix nil pointer dereference in sysctlInspect (#340)
Co-authored-by: hiyongliz <[email protected]>
1 parent d8d0e98 commit 8cc955a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/inspect/sysctl_inspect.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
78
"github.com/kubesphere/event-rule-engine/visitor"
89
kubeeyev1alpha2 "github.com/kubesphere/kubeeye/apis/kubeeye/v1alpha2"
910
"github.com/kubesphere/kubeeye/pkg/constant"
@@ -106,7 +107,7 @@ func (o *sysctlInspect) GetResult(runNodeName string, resultCm *corev1.ConfigMap
106107
}
107108

108109
func parseSysctlVal(val []string) string {
109-
if len(val) == 0 && val == nil {
110+
if len(val) == 0 || val == nil {
110111
return ""
111112
}
112113
return val[0]

0 commit comments

Comments
 (0)