diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2024-03-06 14:47:02 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-03-13 10:31:21 +0000 |
| commit | 20d042025bd8e1f91bb1fec20ae1509a08bfa4ef (patch) | |
| tree | e8a3dcb48db65376fdf865480ca5d043f4c7bdcc /sys/linux/init_vusb.go | |
| parent | 76713834e4ab721bc6265c89203ee171152cc017 (diff) | |
sys/linux: clone args before mutation
Not cloning the argument results in replaceArg() replacing a union
argument with itself, which may lead to inconsistent resource
references.
Add an assertion to detect such cases in the future.
Diffstat (limited to 'sys/linux/init_vusb.go')
| -rw-r--r-- | sys/linux/init_vusb.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/linux/init_vusb.go b/sys/linux/init_vusb.go index 5e4244f6e..ca645bf45 100644 --- a/sys/linux/init_vusb.go +++ b/sys/linux/init_vusb.go @@ -55,7 +55,7 @@ func (arch *arch) generateUsbDeviceDescriptor(g *prog.Gen, typ0 prog.Type, dir p if old == nil { arg = g.GenerateSpecialArg(typ0, dir, &calls) } else { - arg = old + arg = prog.CloneArg(old) calls = g.MutateArg(arg) } if g.Target().ArgContainsAny(arg) { @@ -144,7 +144,7 @@ func (arch *arch) generateUsbHidDeviceDescriptor(g *prog.Gen, typ0 prog.Type, di if old == nil { arg = g.GenerateSpecialArg(typ0, dir, &calls) } else { - arg = old + arg = prog.CloneArg(old) calls = g.MutateArg(arg) } if g.Target().ArgContainsAny(arg) { |
