lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri,  4 Jan 2013 13:05:18 -0800
From:	Greg Thelen <gthelen@...gle.com>
To:	Tejun Heo <tj@...nel.org>, Li Zefan <lizefan@...wei.com>
Cc:	containers@...ts.linux-foundation.org, cgroups@...r.kernel.org,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	Greg Thelen <gthelen@...gle.com>
Subject: [PATCH 2/2] cgroups: fix cgroup_event_listener error handling

If the <absolute-path-to-control-file> command line parameter cannot
be opened, then cgroup_event_listener prints an error message and
tries to return an error.  However, due to an uninitialized variable
the return value was undefined.

With this patch such failures always return non-zero error.

Compiler warning found this:
  $ gcc -Wall -O2 cgroup_event_listener.c
  cgroup_event_listener.c: In function ‘main’:
  cgroup_event_listener.c:109:2: warning: ‘ret’ may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Greg Thelen <gthelen@...gle.com>
---
 tools/cgroup/cgroup_event_listener.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/cgroup/cgroup_event_listener.c b/tools/cgroup/cgroup_event_listener.c
index 3e082f9..a70f00c 100644
--- a/tools/cgroup/cgroup_event_listener.c
+++ b/tools/cgroup/cgroup_event_listener.c
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
 	if (cfd == -1) {
 		fprintf(stderr, "Cannot open %s: %s\n", argv[1],
 				strerror(errno));
-		goto out;
+		return 1;
 	}
 
 	ret = snprintf(event_control_path, PATH_MAX, "%s/cgroup.event_control",
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ