[lxc-devel] [lxcfs/master] proc_{cpuview, loadavg}: fix signed/unsigned check

brauner on Github lxc-bot at linuxcontainers.org
Fri Mar 6 08:56:35 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 365 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200306/aed9a998/attachment.bin>
-------------- next part --------------
From 4f18a6020b1489499f0a38219126c835b45cb636 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 6 Mar 2020 09:55:47 +0100
Subject: [PATCH] proc_{cpuview,loadavg}: fix signed/unsigned check

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/proc_cpuview.c | 3 ++-
 src/proc_loadavg.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/proc_cpuview.c b/src/proc_cpuview.c
index 4fa6306..58cc4e4 100644
--- a/src/proc_cpuview.c
+++ b/src/proc_cpuview.c
@@ -515,7 +515,7 @@ int cpuview_proc_stat(const char *cg, const char *cpuset,
 {
 	__do_free char *line = NULL;
 	__do_free struct cpuacct_usage *diff = NULL;
-	size_t linelen = 0, total_len = 0, l;
+	size_t linelen = 0, total_len = 0;
 	int curcpu = -1; /* cpu numbering starts at 0 */
 	int physcpu, i;
 	int max_cpus = max_cpu_count(cg), cpu_cnt = 0;
@@ -523,6 +523,7 @@ int cpuview_proc_stat(const char *cg, const char *cpuset,
 		 softirq = 0, steal = 0, guest = 0, guest_nice = 0;
 	uint64_t user_sum = 0, system_sum = 0, idle_sum = 0;
 	uint64_t user_surplus = 0, system_surplus = 0;
+	ssize_t l;
 	uint64_t total_sum, threshold;
 	struct cg_proc_stat *stat_node;
 	int nprocs = get_nprocs_conf();
diff --git a/src/proc_loadavg.c b/src/proc_loadavg.c
index c6b8ce1..e5fa6be 100644
--- a/src/proc_loadavg.c
+++ b/src/proc_loadavg.c
@@ -168,7 +168,7 @@ int proc_loadavg_read(char *buf, size_t size, off_t offset,
 	struct fuse_context *fc = fuse_get_context();
 	struct file_info *d = INTTYPE_TO_PTR(fi->fh);
 	pid_t initpid;
-	size_t total_len = 0;
+	ssize_t total_len = 0;
 	char *cache = d->buf;
 	struct load_node *n;
 	int hash;


More information about the lxc-devel mailing list