From 73e78a5822224bd7640888b6b5c2ab6b3f35bd13 Mon Sep 17 00:00:00 2001 From: Jianyong Wu Date: Wed, 7 Aug 2024 02:27:21 +0000 Subject: [PATCH] run: fix GetList return empty issue for throttledevice 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 Fixes: #5321 --- opts/throttledevice.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opts/throttledevice.go b/opts/throttledevice.go index bdf454eb27..8bf1288047 100644 --- a/opts/throttledevice.go +++ b/opts/throttledevice.go @@ -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 }