aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mdev.c5
-rw-r--r--util-linux/mount.c19
-rw-r--r--util-linux/switch_root.c14
-rw-r--r--util-linux/volume_id/util.c4
-rw-r--r--util-linux/volume_id/volume_id.c2
5 files changed, 23 insertions, 21 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 4fff20dcd..14aa593f5 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -120,8 +120,11 @@ static void make_device(char *path, int delete)
120 120
121 /* If not this device, skip rest of line */ 121 /* If not this device, skip rest of line */
122 /* (regexec returns whole pattern as "range" 0) */ 122 /* (regexec returns whole pattern as "range" 0) */
123 if (result || off[0].rm_so || off[0].rm_eo != strlen(device_name)) 123 if (result || off[0].rm_so
124 || ((int)off[0].rm_eo != (int)strlen(device_name))
125 ) {
124 goto next_line; 126 goto next_line;
127 }
125 } 128 }
126 129
127 /* This line matches: stop parsing the file 130 /* This line matches: stop parsing the file
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 4b8aea8c6..292f877af 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -307,7 +307,7 @@ static long parse_mount_options(char *options, char **unrecognized)
307 307
308 // Loop through options 308 // Loop through options
309 for (;;) { 309 for (;;) {
310 int i; 310 size_t i;
311 char *comma = strchr(options, ','); 311 char *comma = strchr(options, ',');
312 const char *option_str = mount_option_str; 312 const char *option_str = mount_option_str;
313 313
@@ -1004,7 +1004,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1004 bb_herror_msg("%s", hostname); 1004 bb_herror_msg("%s", hostname);
1005 goto fail; 1005 goto fail;
1006 } 1006 }
1007 if (hp->h_length > sizeof(struct in_addr)) { 1007 if ((size_t)hp->h_length > sizeof(struct in_addr)) {
1008 bb_error_msg("got bad hp->h_length"); 1008 bb_error_msg("got bad hp->h_length");
1009 hp->h_length = sizeof(struct in_addr); 1009 hp->h_length = sizeof(struct in_addr);
1010 } 1010 }
@@ -1279,15 +1279,14 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1279 if (hp == NULL) { 1279 if (hp == NULL) {
1280 bb_herror_msg("%s", mounthost); 1280 bb_herror_msg("%s", mounthost);
1281 goto fail; 1281 goto fail;
1282 } else {
1283 if (hp->h_length > sizeof(struct in_addr)) {
1284 bb_error_msg("got bad hp->h_length?");
1285 hp->h_length = sizeof(struct in_addr);
1286 }
1287 mount_server_addr.sin_family = AF_INET;
1288 memcpy(&mount_server_addr.sin_addr,
1289 hp->h_addr, hp->h_length);
1290 } 1282 }
1283 if ((size_t)hp->h_length > sizeof(struct in_addr)) {
1284 bb_error_msg("got bad hp->h_length");
1285 hp->h_length = sizeof(struct in_addr);
1286 }
1287 mount_server_addr.sin_family = AF_INET;
1288 memcpy(&mount_server_addr.sin_addr,
1289 hp->h_addr, hp->h_length);
1291 } 1290 }
1292 } 1291 }
1293 1292
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index c030b99e1..bae695b0b 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -13,15 +13,15 @@
13// Make up for header deficiencies. 13// Make up for header deficiencies.
14 14
15#ifndef RAMFS_MAGIC 15#ifndef RAMFS_MAGIC
16#define RAMFS_MAGIC 0x858458f6 16#define RAMFS_MAGIC ((unsigned)0x858458f6)
17#endif 17#endif
18 18
19#ifndef TMPFS_MAGIC 19#ifndef TMPFS_MAGIC
20#define TMPFS_MAGIC 0x01021994 20#define TMPFS_MAGIC ((unsigned)0x01021994)
21#endif 21#endif
22 22
23#ifndef MS_MOVE 23#ifndef MS_MOVE
24#define MS_MOVE 8192 24#define MS_MOVE 8192
25#endif 25#endif
26 26
27static dev_t rootdev; 27static dev_t rootdev;
@@ -91,10 +91,10 @@ int switch_root_main(int argc ATTRIBUTE_UNUSED, char **argv)
91 // we mean it. (I could make this a CONFIG option, but I would get email 91 // we mean it. (I could make this a CONFIG option, but I would get email
92 // from all the people who WILL eat their filesystems.) 92 // from all the people who WILL eat their filesystems.)
93 93
94 if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs) || 94 if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs)
95 (stfs.f_type != RAMFS_MAGIC && stfs.f_type != TMPFS_MAGIC) || 95 || (((unsigned)stfs.f_type != RAMFS_MAGIC) && ((unsigned)stfs.f_type != TMPFS_MAGIC))
96 getpid() != 1) 96 || (getpid() != 1)
97 { 97 ) {
98 bb_error_msg_and_die("not rootfs"); 98 bb_error_msg_and_die("not rootfs");
99 } 99 }
100 100
diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c
index ce7de23fb..240b3c1e3 100644
--- a/util-linux/volume_id/util.c
+++ b/util-linux/volume_id/util.c
@@ -212,7 +212,7 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
212 } 212 }
213 dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); 213 dbg("got 0x%zx (%zi) bytes", buf_len, buf_len);
214 id->sbbuf_len = buf_len; 214 id->sbbuf_len = buf_len;
215 if (buf_len < off + len) { 215 if ((uint64_t)buf_len < off + len) {
216 dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); 216 dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len);
217 return NULL; 217 return NULL;
218 } 218 }
@@ -243,7 +243,7 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
243 dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); 243 dbg("got 0x%zx (%zi) bytes", buf_len, buf_len);
244 id->seekbuf_off = off; 244 id->seekbuf_off = off;
245 id->seekbuf_len = buf_len; 245 id->seekbuf_len = buf_len;
246 if (buf_len < len) { 246 if ((size_t)buf_len < len) {
247 dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); 247 dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len);
248 return NULL; 248 return NULL;
249 } 249 }
diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c
index de9aae2ce..aec96a26e 100644
--- a/util-linux/volume_id/volume_id.c
+++ b/util-linux/volume_id/volume_id.c
@@ -152,7 +152,7 @@ static const probe_fptr fs2[] = {
152 152
153int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) 153int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size)
154{ 154{
155 int i; 155 size_t i;
156 156
157 if (id == NULL) 157 if (id == NULL)
158 return -EINVAL; 158 return -EINVAL;