* [PATCH] selftests: net: devlink_port_split: check devlink returned an element before dereferencing it
@ 2021-06-28 14:54 Paolo Pisati
2021-06-28 23:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Pisati @ 2021-06-28 14:54 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Shuah Khan
Cc: netdev, linux-kselftest, linux-kernel
And thus avoid a Python stacktrace:
~/linux/tools/testing/selftests/net$ ./devlink_port_split.py
Traceback (most recent call last):
File "/home/linux/tools/testing/selftests/net/./devlink_port_split.py",
line 277, in <module> main()
File "/home/linux/tools/testing/selftests/net/./devlink_port_split.py",
line 242, in main
dev = list(devs.keys())[0]
IndexError: list index out of range
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
---
tools/testing/selftests/net/devlink_port_split.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/net/devlink_port_split.py b/tools/testing/selftests/net/devlink_port_split.py
index 834066d465fc..d162915311fd 100755
--- a/tools/testing/selftests/net/devlink_port_split.py
+++ b/tools/testing/selftests/net/devlink_port_split.py
@@ -239,6 +239,9 @@ def main(cmdline=None):
assert stderr == ""
devs = json.loads(stdout)['dev']
+ if len(devs.keys()) == 0:
+ print("no devlink device found")
+ sys.exit(1)
dev = list(devs.keys())[0]
cmd = "devlink dev show %s" % dev
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests: net: devlink_port_split: check devlink returned an element before dereferencing it
2021-06-28 14:54 [PATCH] selftests: net: devlink_port_split: check devlink returned an element before dereferencing it Paolo Pisati
@ 2021-06-28 23:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-28 23:20 UTC (permalink / raw)
To: Paolo Pisati; +Cc: davem, kuba, shuah, netdev, linux-kselftest, linux-kernel
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Mon, 28 Jun 2021 16:54:24 +0200 you wrote:
> And thus avoid a Python stacktrace:
>
> ~/linux/tools/testing/selftests/net$ ./devlink_port_split.py
> Traceback (most recent call last):
> File "/home/linux/tools/testing/selftests/net/./devlink_port_split.py",
> line 277, in <module> main()
> File "/home/linux/tools/testing/selftests/net/./devlink_port_split.py",
> line 242, in main
> dev = list(devs.keys())[0]
> IndexError: list index out of range
>
> [...]
Here is the summary with links:
- selftests: net: devlink_port_split: check devlink returned an element before dereferencing it
https://git.kernel.org/netdev/net/c/a118ff661889
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-28 23:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 14:54 [PATCH] selftests: net: devlink_port_split: check devlink returned an element before dereferencing it Paolo Pisati
2021-06-28 23:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).