Skip to content

Commit

Permalink
fix(unikraft): Properly parse kernel arguments before forwarding them (
Browse files Browse the repository at this point in the history
…#737)

Reviewed-by: Jakub Ciolek <[email protected]>
Approved-by: Jakub Ciolek <[email protected]>
  • Loading branch information
jake-ciolek authored Aug 23, 2023
2 parents bbfbfc8 + d40a6dd commit 61635e5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions unikraft/export/v0/ukargparse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ func Parse(args ...string) (Params, error) {
params := []Param{}

for _, arg := range args {
libAndName := strings.SplitN(arg, ".", 1)
nameAndValue := strings.Split(arg, "=")
if len(nameAndValue) != 2 {
return nil, fmt.Errorf("expected param to be in the format 'libname.param=value' but got: '%s'", arg)
}

libAndName := strings.Split(nameAndValue[0], ".")
if len(libAndName) != 2 {
return nil, fmt.Errorf("expected param to be in the format 'libname.param=value' but got: '%s'", arg)
}

param := paramStr{
library: libAndName[0],
name: libAndName[1],
}

if strings.Contains(arg, "=") {
nameAndValue := strings.SplitN(arg, "=", 1)
param.value = nameAndValue[1]
value: nameAndValue[1],
}

params = append(params, &param)
Expand Down

0 comments on commit 61635e5

Please sign in to comment.