[lxc-devel] [lxc/master] cgfsng: do not use uninitialized variable
brauner on Github
lxc-bot at linuxcontainers.org
Tue Aug 8 18:38:32 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170808/9d6439bf/attachment.bin>
-------------- next part --------------
From 127a4f044d365eb0e10748921518c7cfd9d916b4 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 8 Aug 2017 20:35:43 +0200
Subject: [PATCH 1/2] cgfsng: do not use uninitialized variable
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/cgroups/cgfsng.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 5e131683f..10d8ce631 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -1904,10 +1904,12 @@ static int cgfsng_set(const char *filename, const char *value, const char *name,
*/
static int convert_devpath(const char *invalue, char *dest)
{
- char *p, *path, *mode, type;
+ int n_parts;
+ char *p, *path, type;
struct stat sb;
unsigned long minor, major;
- int n_parts, ret = -EINVAL;
+ int ret = -EINVAL;
+ char *mode = NULL;
path = must_copy_string(invalue);
@@ -1931,6 +1933,11 @@ static int convert_devpath(const char *invalue, char *dest)
goto out;
}
+ if (!mode) {
+ ERROR("Device setting is missing a mode (e.g. rwm) argument");
+ goto out;
+ }
+
if (n_parts == 1)
goto out;
@@ -1956,8 +1963,8 @@ static int convert_devpath(const char *invalue, char *dest)
minor = MINOR(sb.st_rdev);
ret = snprintf(dest, 50, "%c %lu:%lu %s", type, major, minor, mode);
if (ret < 0 || ret >= 50) {
- ERROR("Error on configuration value \"%c %lu:%lu %s\" (max 50 chars)",
- type, major, minor, mode);
+ ERROR("Error on configuration value \"%c %lu:%lu %s\" (max 50 "
+ "chars)", type, major, minor, mode);
ret = -ENAMETOOLONG;
goto out;
}
From 2c5dfdf8933ab23ec355adebfad1bc0c7709aa9b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 8 Aug 2017 20:37:43 +0200
Subject: [PATCH 2/2] storage: fix android builds
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/storage/storage.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c
index fee3d8df1..52164266a 100644
--- a/src/lxc/storage/storage.c
+++ b/src/lxc/storage/storage.c
@@ -65,6 +65,12 @@
#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
#endif
+#if IS_BIONIC
+#include <../include/lxcmntent.h>
+#else
+#include <mntent.h>
+#endif
+
lxc_log_define(storage, lxc);
/* aufs */
More information about the lxc-devel
mailing list