[lxc-devel] [lxd/master] devices: fail if Nvidia device minor is missing

brauner on Github lxc-bot at linuxcontainers.org
Wed Apr 11 15:02:34 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 381 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180411/5ee9ccad/attachment.bin>
-------------- next part --------------
From 073bd0dfcf4f6f9b8a060bc79285c99f612b8339 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 11 Apr 2018 17:00:04 +0200
Subject: [PATCH] devices: fail if Nvidia device minor is missing

Closes #4441.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/devices.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lxd/devices.go b/lxd/devices.go
index b023f3dba1..8aa057dcc4 100644
--- a/lxd/devices.go
+++ b/lxd/devices.go
@@ -211,6 +211,9 @@ func deviceLoadGpu() ([]gpuDevice, []nvidiaGpuDevices, error) {
 				}
 				strBuf := strings.TrimSpace(string(buf))
 				idx := strings.Index(strBuf, "Device Minor:")
+				if idx == -1 {
+					return nil, nil, fmt.Errorf("No device minor index detected")
+				}
 				idx += len("Device Minor:")
 				strBuf = strBuf[idx:]
 				strBuf = strings.TrimSpace(strBuf)


More information about the lxc-devel mailing list