Skip to content

Commit

Permalink
run: fix GetList return empty issue for throttledevice
Browse files Browse the repository at this point in the history
Test "--device-read-bps" "--device-write-bps" will fail. The root
cause is that GetList helper return empty as its local variable
initialized to zero size.

This patch fix it by setting the related slice size to non-zero.

Signed-off-by: Jianyong Wu <[email protected]>
Fixes: #5321
(cherry picked from commit 73e78a5)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
jongwu authored and thaJeztah committed Aug 9, 2024
1 parent 32b99dd commit a73610d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opts/throttledevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (opt *ThrottledeviceOpt) String() string {

// GetList returns a slice of pointers to ThrottleDevices.
func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice {
out := make([]*blkiodev.ThrottleDevice, 0, len(opt.values))
out := make([]*blkiodev.ThrottleDevice, len(opt.values))
copy(out, opt.values)
return out
}
Expand Down

0 comments on commit a73610d

Please sign in to comment.