lxcfs/0019-use-bitwise-operators-only-on-unsigned.patch
2019-11-06 19:42:23 +08:00

42 lines
1.4 KiB
Diff

diff --git a/bindings.c b/bindings.c
--- a/bindings.c
+++ b/bindings.c
@@ -4037,7 +4037,7 @@ struct devinfo {
struct devinfo *next;
};
-int getns(pid_t pid, char *ns_type)
+int getns(pid_t pid, const char *ns_type)
{
char fpath[100];
memset(fpath, 0, sizeof(fpath));
@@ -4145,8 +4145,8 @@ child_out:
}
end->next = NULL;
end->name = must_copy_string(dev_name);
- end->major = (dev_num & 0xff00) >> 8;
- end->minor = dev_num & 0x00ff;
+ end->major = ((unsigned int)dev_num & 0xff00) >> 8;
+ end->minor = (unsigned int)dev_num & 0x00ff;
}
err:
if (stream[0])
@@ -4185,7 +4185,7 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
char tmp_dev_name[72];
struct fuse_context *fc = fuse_get_context();
struct file_info *d = (struct file_info *)fi->fh;
- struct devinfo *container_devinfo = NULL, *ptr;
+ struct devinfo *container_devinfo = NULL, *ptr = NULL;
char *cg = NULL;
char *io_serviced_str = NULL, *io_merged_str = NULL, *io_service_bytes_str = NULL,
*io_wait_time_str = NULL, *io_service_time_str = NULL;
@@ -4510,7 +4510,7 @@ static int proc_partitions_read(char *buf, size_t size, off_t offset,
char lbuf[256];
if (lines < 2) {
- ret = strncpy_s(lbuf, 256, line, 255);
+ ret = strncpy_s(lbuf, sizeof(lbuf), line, sizeof(lbuf)-1);
if (ret != 0) {
lxcfs_error("%s\n", "Internal error: strncpy line failed");
rv = 0;