Merge lp:~tyhicks/ecryptfs/fix-most-Wall-and-Wextra-warnings into lp:ecryptfs
- fix-most-Wall-and-Wextra-warnings
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 814 |
Proposed branch: | lp:~tyhicks/ecryptfs/fix-most-Wall-and-Wextra-warnings |
Merge into: | lp:ecryptfs |
Diff against target: |
615 lines (+103/-104) 17 files modified
src/libecryptfs/ecryptfs-stat.c (+1/-1) src/libecryptfs/key_management.c (+0/-1) src/libecryptfs/miscdev.c (+1/-1) src/libecryptfs/module_mgr.c (+60/-39) src/pam_ecryptfs/pam_ecryptfs.c (+0/-31) src/utils/mount.ecryptfs.c (+1/-0) src/utils/mount.ecryptfs_private.c (+10/-7) src/utils/test.c (+6/-6) tests/kernel/directory-concurrent/test.c (+1/-1) tests/kernel/enospc/test.c (+0/-1) tests/kernel/extend-file-random/test.c (+16/-2) tests/kernel/file-concurrent/test.c (+1/-1) tests/kernel/inode-race-stat/test.c (+2/-3) tests/kernel/inotify/test.c (+1/-1) tests/kernel/lp-509180/test.c (+0/-1) tests/kernel/trunc-file/test.c (+2/-7) tests/userspace/wrap-unwrap/test.c (+1/-1) |
To merge this branch: | bzr merge lp:~tyhicks/ecryptfs/fix-most-Wall-and-Wextra-warnings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Ian King (community) | Approve | ||
Review via email: mp+192913@code.launchpad.net |
Commit message
Description of the change
This is a good start towards fixing all warnings emitted when building with
the output of Saucy's `dpkg-buildflags --dump` plus '-Wall -Wextra' on amd64,
i386, and armhf.
I want to have a quiet, warning-free build so that we can use the compiler to
help a little more with catching bugs in new commits. I don't want to go as far
as enabling -Werror by default, but it'd be nice to have the option of using it
locally when developing/
What's left is:
[-Wmissing-
[-Wunused-
[-Wunused-result]
I'll fix those remaining three very soon. I just didn't get to them before
Monday rolled around.
Tyler Hicks (tyhicks) wrote : | # |
Colin Ian King (colin-king) wrote : | # |
These look good to me. I've run them through Coverity Scan too and it looks fine.
Tyler Hicks (tyhicks) wrote : | # |
I pushed one more patch, r815, that fixed a bug in r801. I typoed the overflow check conditional. I should have used UINTMAX_MAX instead of UINT_MAX.
Colin Ian King (colin-king) wrote : | # |
Ah, I didn't spot that, so much for my careful reviewing :-/
Tyler Hicks (tyhicks) wrote : | # |
The name of those macros are too easy to get switched around. I caught it out of sheer luck during my last second check before pushing.
Preview Diff
1 | === modified file 'src/libecryptfs/ecryptfs-stat.c' | |||
2 | --- src/libecryptfs/ecryptfs-stat.c 2013-03-13 14:52:43 +0000 | |||
3 | +++ src/libecryptfs/ecryptfs-stat.c 2013-10-28 17:50:31 +0000 | |||
4 | @@ -80,7 +80,7 @@ | |||
5 | 80 | char *buf, int *bytes_read) | 80 | char *buf, int *bytes_read) |
6 | 81 | { | 81 | { |
7 | 82 | int rc = 0; | 82 | int rc = 0; |
9 | 83 | int i; | 83 | size_t i; |
10 | 84 | uint32_t flags; | 84 | uint32_t flags; |
11 | 85 | int big_endian; | 85 | int big_endian; |
12 | 86 | 86 | ||
13 | 87 | 87 | ||
14 | === modified file 'src/libecryptfs/key_management.c' | |||
15 | --- src/libecryptfs/key_management.c 2013-10-25 19:45:09 +0000 | |||
16 | +++ src/libecryptfs/key_management.c 2013-10-28 17:50:31 +0000 | |||
17 | @@ -247,7 +247,6 @@ | |||
18 | 247 | int rc = 0; | 247 | int rc = 0; |
19 | 248 | ssize_t size; | 248 | ssize_t size; |
20 | 249 | int fd; | 249 | int fd; |
21 | 250 | int i; | ||
22 | 251 | char *p = NULL; | 250 | char *p = NULL; |
23 | 252 | char decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1]; | 251 | char decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1]; |
24 | 253 | 252 | ||
25 | 254 | 253 | ||
26 | === modified file 'src/libecryptfs/miscdev.c' | |||
27 | --- src/libecryptfs/miscdev.c 2013-10-25 19:45:09 +0000 | |||
28 | +++ src/libecryptfs/miscdev.c 2013-10-28 17:50:31 +0000 | |||
29 | @@ -153,7 +153,7 @@ | |||
30 | 153 | packet_len = 0; | 153 | packet_len = 0; |
31 | 154 | } | 154 | } |
32 | 155 | miscdev_msg_data_size = (1 + 4 + packet_len_size + packet_len); | 155 | miscdev_msg_data_size = (1 + 4 + packet_len_size + packet_len); |
34 | 156 | if (miscdev_msg_data_size != read_bytes) { | 156 | if (miscdev_msg_data_size != (size_t)read_bytes) { |
35 | 157 | rc = -EINVAL; | 157 | rc = -EINVAL; |
36 | 158 | syslog(LOG_ERR, "%s: Invalid packet. (1 + 4 + " | 158 | syslog(LOG_ERR, "%s: Invalid packet. (1 + 4 + " |
37 | 159 | "packet_len_size=[%zu] + packet_len=[%zu])=[%zu] != " | 159 | "packet_len_size=[%zu] + packet_len=[%zu])=[%zu] != " |
38 | 160 | 160 | ||
39 | === modified file 'src/libecryptfs/module_mgr.c' | |||
40 | --- src/libecryptfs/module_mgr.c 2013-10-25 19:45:09 +0000 | |||
41 | +++ src/libecryptfs/module_mgr.c 2013-10-28 17:50:31 +0000 | |||
42 | @@ -23,6 +23,8 @@ | |||
43 | 23 | #include <string.h> | 23 | #include <string.h> |
44 | 24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
45 | 25 | #include <stdio.h> | 25 | #include <stdio.h> |
46 | 26 | #include <stdint.h> | ||
47 | 27 | #include <inttypes.h> | ||
48 | 26 | #include "../include/ecryptfs.h" | 28 | #include "../include/ecryptfs.h" |
49 | 27 | #include "../include/decision_graph.h" | 29 | #include "../include/decision_graph.h" |
50 | 28 | 30 | ||
51 | @@ -265,8 +267,9 @@ | |||
52 | 265 | } else if (node->val) { | 267 | } else if (node->val) { |
53 | 266 | if (yn < 0) | 268 | if (yn < 0) |
54 | 267 | rc = WRONG_VALUE; | 269 | rc = WRONG_VALUE; |
56 | 268 | } else | 270 | } else { |
57 | 269 | /* default: no */; | 271 | /* default: no */; |
58 | 272 | } | ||
59 | 270 | out_free: | 273 | out_free: |
60 | 271 | if (node->val) { | 274 | if (node->val) { |
61 | 272 | free(node->val); | 275 | free(node->val); |
62 | @@ -389,33 +392,32 @@ | |||
63 | 389 | static struct supported_key_bytes { | 392 | static struct supported_key_bytes { |
64 | 390 | char *cipher_name; | 393 | char *cipher_name; |
65 | 391 | uint32_t key_bytes; | 394 | uint32_t key_bytes; |
66 | 392 | uint32_t order; | ||
67 | 393 | } supported_key_bytes[] = { | 395 | } supported_key_bytes[] = { |
93 | 394 | {"aes", 16, 1}, | 396 | {"aes", 16}, |
94 | 395 | {"aes", 32, 2}, | 397 | {"aes", 32}, |
95 | 396 | {"aes", 24, 3}, | 398 | {"aes", 24}, |
96 | 397 | {"anubis", 16, 1}, | 399 | {"anubis", 16}, |
97 | 398 | {"anubis", 32, 2}, | 400 | {"anubis", 32}, |
98 | 399 | {"des3_ede", 24, 1}, | 401 | {"des3_ede", 24}, |
99 | 400 | {"serpent", 16, 1}, | 402 | {"serpent", 16}, |
100 | 401 | {"serpent", 32, 2}, | 403 | {"serpent", 32}, |
101 | 402 | {"tnepres", 16, 1}, | 404 | {"tnepres", 16}, |
102 | 403 | {"tnepres", 32, 2}, | 405 | {"tnepres", 32}, |
103 | 404 | {"tea", 16, 1}, | 406 | {"tea", 16}, |
104 | 405 | {"xeta", 16, 1}, | 407 | {"xeta", 16}, |
105 | 406 | {"xtea", 16, 1}, | 408 | {"xtea", 16}, |
106 | 407 | {"cast5", 16, 1}, | 409 | {"cast5", 16}, |
107 | 408 | {"cast6", 16, 1}, | 410 | {"cast6", 16}, |
108 | 409 | {"cast6", 32, 2}, | 411 | {"cast6", 32}, |
109 | 410 | {"twofish", 16, 1}, | 412 | {"twofish", 16}, |
110 | 411 | {"twofish", 32, 2}, | 413 | {"twofish", 32}, |
111 | 412 | {"blowfish", 16, 1}, | 414 | {"blowfish", 16}, |
112 | 413 | {"blowfish", 32, 2}, | 415 | {"blowfish", 32}, |
113 | 414 | {"blowfish", 56, 2}, | 416 | {"blowfish", 56}, |
114 | 415 | {"khazad", 16, 1}, | 417 | {"khazad", 16}, |
115 | 416 | {"arc4", 16, 1}, | 418 | {"arc4", 16}, |
116 | 417 | {"arc4", 32, 2}, | 419 | {"arc4", 32}, |
117 | 418 | {NULL, 0, 0} | 420 | {NULL, 0} |
118 | 419 | }; | 421 | }; |
119 | 420 | 422 | ||
120 | 421 | static int tf_ecryptfs_key_bytes(struct ecryptfs_ctx *ctx, | 423 | static int tf_ecryptfs_key_bytes(struct ecryptfs_ctx *ctx, |
121 | @@ -438,7 +440,7 @@ | |||
122 | 438 | } | 440 | } |
123 | 439 | 441 | ||
124 | 440 | static int init_ecryptfs_key_bytes_param_node(char *cipher_name, | 442 | static int init_ecryptfs_key_bytes_param_node(char *cipher_name, |
126 | 441 | int min, int max) | 443 | uint32_t min, uint32_t max) |
127 | 442 | { | 444 | { |
128 | 443 | int i; | 445 | int i; |
129 | 444 | int rc = 0; | 446 | int rc = 0; |
130 | @@ -453,7 +455,7 @@ | |||
131 | 453 | 455 | ||
132 | 454 | tn = &ecryptfs_key_bytes_param_node.tl[ | 456 | tn = &ecryptfs_key_bytes_param_node.tl[ |
133 | 455 | ecryptfs_key_bytes_param_node.num_transitions]; | 457 | ecryptfs_key_bytes_param_node.num_transitions]; |
135 | 456 | rc = asprintf(&tn->val, "%d", | 458 | rc = asprintf(&tn->val, "%"PRIu32, |
136 | 457 | supported_key_bytes[i].key_bytes); | 459 | supported_key_bytes[i].key_bytes); |
137 | 458 | if (rc == -1) { | 460 | if (rc == -1) { |
138 | 459 | rc = -ENOMEM; | 461 | rc = -ENOMEM; |
139 | @@ -462,7 +464,7 @@ | |||
140 | 462 | rc = 0; | 464 | rc = 0; |
141 | 463 | if (!ecryptfs_key_bytes_param_node.suggested_val) { | 465 | if (!ecryptfs_key_bytes_param_node.suggested_val) { |
142 | 464 | rc = asprintf(&ecryptfs_key_bytes_param_node.suggested_val, | 466 | rc = asprintf(&ecryptfs_key_bytes_param_node.suggested_val, |
144 | 465 | "%d", | 467 | "%"PRIu32, |
145 | 466 | supported_key_bytes[i].key_bytes); | 468 | supported_key_bytes[i].key_bytes); |
146 | 467 | if (rc == -1) { | 469 | if (rc == -1) { |
147 | 468 | rc = -ENOMEM; | 470 | rc = -ENOMEM; |
148 | @@ -485,12 +487,33 @@ | |||
149 | 485 | return rc; | 487 | return rc; |
150 | 486 | } | 488 | } |
151 | 487 | 489 | ||
152 | 490 | static int parse_key_bytes(uint32_t *bytes, const char *str) | ||
153 | 491 | { | ||
154 | 492 | uintmax_t tmp; | ||
155 | 493 | char *eptr; | ||
156 | 494 | |||
157 | 495 | if (str[0] == '-') | ||
158 | 496 | return -ERANGE; | ||
159 | 497 | |||
160 | 498 | errno = 0; | ||
161 | 499 | tmp = strtoumax(str, &eptr, 10); | ||
162 | 500 | if (eptr == str) | ||
163 | 501 | return -EINVAL; | ||
164 | 502 | else if (tmp == UINT_MAX && errno == ERANGE) | ||
165 | 503 | return -ERANGE; | ||
166 | 504 | else if (tmp > UINT32_MAX) | ||
167 | 505 | return -ERANGE; | ||
168 | 506 | |||
169 | 507 | *bytes = (uint32_t)tmp; | ||
170 | 508 | return 0; | ||
171 | 509 | } | ||
172 | 510 | |||
173 | 488 | static int tf_ecryptfs_cipher(struct ecryptfs_ctx *ctx, struct param_node *node, | 511 | static int tf_ecryptfs_cipher(struct ecryptfs_ctx *ctx, struct param_node *node, |
174 | 489 | struct val_node **head, void **foo) | 512 | struct val_node **head, void **foo) |
175 | 490 | { | 513 | { |
176 | 491 | char *opt; | 514 | char *opt; |
177 | 492 | int rc; | 515 | int rc; |
179 | 493 | int min = 0, max = 999999; | 516 | uint32_t min = 0, max = 999999; |
180 | 494 | struct val_node *tmp = *head, *tmpprev = NULL; | 517 | struct val_node *tmp = *head, *tmpprev = NULL; |
181 | 495 | 518 | ||
182 | 496 | while (tmp) { | 519 | while (tmp) { |
183 | @@ -498,18 +521,16 @@ | |||
184 | 498 | int popval = 0; | 521 | int popval = 0; |
185 | 499 | if (tmp->val && (strstr(tmp->val,"max_key_bytes=") != NULL) && | 522 | if (tmp->val && (strstr(tmp->val,"max_key_bytes=") != NULL) && |
186 | 500 | ((ptr=strchr(tmp->val,'=')) != NULL)) { | 523 | ((ptr=strchr(tmp->val,'=')) != NULL)) { |
191 | 501 | char *eptr; | 524 | rc = parse_key_bytes(&max, ++ptr); |
192 | 502 | max = strtol(++ptr, &eptr, 10); | 525 | if (rc) |
193 | 503 | if (eptr == ptr) | 526 | return rc; |
190 | 504 | return -EINVAL; | ||
194 | 505 | popval = 1; | 527 | popval = 1; |
195 | 506 | } | 528 | } |
196 | 507 | if (tmp->val && (strstr(tmp->val,"min_key_bytes=") != NULL) && | 529 | if (tmp->val && (strstr(tmp->val,"min_key_bytes=") != NULL) && |
197 | 508 | ((ptr=strchr(tmp->val,'=')) != NULL)) { | 530 | ((ptr=strchr(tmp->val,'=')) != NULL)) { |
202 | 509 | char *eptr; | 531 | rc = parse_key_bytes(&min, ++ptr); |
203 | 510 | min = strtol(++ptr, &eptr, 10); | 532 | if (rc) |
204 | 511 | if (eptr == ptr) | 533 | return rc; |
201 | 512 | return -EINVAL; | ||
205 | 513 | popval = 1; | 534 | popval = 1; |
206 | 514 | } | 535 | } |
207 | 515 | if (popval) { | 536 | if (popval) { |
208 | 516 | 537 | ||
209 | === modified file 'src/pam_ecryptfs/pam_ecryptfs.c' | |||
210 | --- src/pam_ecryptfs/pam_ecryptfs.c 2013-10-25 19:45:09 +0000 | |||
211 | +++ src/pam_ecryptfs/pam_ecryptfs.c 2013-10-28 17:50:31 +0000 | |||
212 | @@ -46,31 +46,6 @@ | |||
213 | 46 | 46 | ||
214 | 47 | #define PRIVATE_DIR "Private" | 47 | #define PRIVATE_DIR "Private" |
215 | 48 | 48 | ||
216 | 49 | static void error(const char *msg) | ||
217 | 50 | { | ||
218 | 51 | syslog(LOG_ERR, "pam_ecryptfs: errno = [%i]; strerror = [%m]\n", errno); | ||
219 | 52 | switch (errno) { | ||
220 | 53 | case ENOKEY: | ||
221 | 54 | syslog(LOG_ERR, "pam_ecryptfs: %s: Requested key not available\n", msg); | ||
222 | 55 | return; | ||
223 | 56 | |||
224 | 57 | case EKEYEXPIRED: | ||
225 | 58 | syslog(LOG_ERR, "pam_ecryptfs: %s: Key has expired\n", msg); | ||
226 | 59 | return; | ||
227 | 60 | |||
228 | 61 | case EKEYREVOKED: | ||
229 | 62 | syslog(LOG_ERR, "pam_ecryptfs: %s: Key has been revoked\n", msg); | ||
230 | 63 | return; | ||
231 | 64 | |||
232 | 65 | case EKEYREJECTED: | ||
233 | 66 | syslog(LOG_ERR, "pam_ecryptfs: %s: Key was rejected by service\n", msg); | ||
234 | 67 | return; | ||
235 | 68 | default: | ||
236 | 69 | syslog(LOG_ERR, "pam_ecryptfs: %s: Unknown key error\n", msg); | ||
237 | 70 | return; | ||
238 | 71 | } | ||
239 | 72 | } | ||
240 | 73 | |||
241 | 74 | /* returns: 0 if file does not exist, 1 if it exists, <0 for error */ | 49 | /* returns: 0 if file does not exist, 1 if it exists, <0 for error */ |
242 | 75 | static int file_exists_dotecryptfs(const char *homedir, char *filename) | 50 | static int file_exists_dotecryptfs(const char *homedir, char *filename) |
243 | 76 | { | 51 | { |
244 | @@ -211,8 +186,6 @@ | |||
245 | 211 | if ((argc == 1) | 186 | if ((argc == 1) |
246 | 212 | && (memcmp(argv[0], "unwrap\0", 7) == 0)) { | 187 | && (memcmp(argv[0], "unwrap\0", 7) == 0)) { |
247 | 213 | char *wrapped_pw_filename; | 188 | char *wrapped_pw_filename; |
248 | 214 | char *unwrapped_pw_filename; | ||
249 | 215 | struct stat s; | ||
250 | 216 | 189 | ||
251 | 217 | rc = asprintf( | 190 | rc = asprintf( |
252 | 218 | &wrapped_pw_filename, "%s/.ecryptfs/%s", | 191 | &wrapped_pw_filename, "%s/.ecryptfs/%s", |
253 | @@ -306,8 +279,6 @@ | |||
254 | 306 | char *autoumount = "auto-umount"; | 279 | char *autoumount = "auto-umount"; |
255 | 307 | struct stat s; | 280 | struct stat s; |
256 | 308 | pid_t pid; | 281 | pid_t pid; |
257 | 309 | struct utmp *u; | ||
258 | 310 | int count = 0; | ||
259 | 311 | 282 | ||
260 | 312 | if ((pwd = fetch_pwd(pamh)) == NULL) { | 283 | if ((pwd = fetch_pwd(pamh)) == NULL) { |
261 | 313 | /* fetch_pwd() logged a message */ | 284 | /* fetch_pwd() logged a message */ |
262 | @@ -433,7 +404,6 @@ | |||
263 | 433 | char *old_passphrase = NULL; | 404 | char *old_passphrase = NULL; |
264 | 434 | char *new_passphrase = NULL; | 405 | char *new_passphrase = NULL; |
265 | 435 | char *wrapped_pw_filename; | 406 | char *wrapped_pw_filename; |
266 | 436 | char *name = NULL; | ||
267 | 437 | char salt[ECRYPTFS_SALT_SIZE]; | 407 | char salt[ECRYPTFS_SALT_SIZE]; |
268 | 438 | char salt_hex[ECRYPTFS_SALT_SIZE_HEX]; | 408 | char salt_hex[ECRYPTFS_SALT_SIZE_HEX]; |
269 | 439 | pid_t child_pid, tmp_pid; | 409 | pid_t child_pid, tmp_pid; |
270 | @@ -448,7 +418,6 @@ | |||
271 | 448 | uid = pwd->pw_uid; | 418 | uid = pwd->pw_uid; |
272 | 449 | gid = pwd->pw_gid; | 419 | gid = pwd->pw_gid; |
273 | 450 | homedir = pwd->pw_dir; | 420 | homedir = pwd->pw_dir; |
274 | 451 | name = pwd->pw_name; | ||
275 | 452 | } | 421 | } |
276 | 453 | } else { | 422 | } else { |
277 | 454 | syslog(LOG_ERR, "pam_ecryptfs: Error getting passwd info for user [%s]; rc = [%d]\n", username, rc); | 423 | syslog(LOG_ERR, "pam_ecryptfs: Error getting passwd info for user [%s]; rc = [%d]\n", username, rc); |
278 | 455 | 424 | ||
279 | === modified file 'src/utils/mount.ecryptfs.c' | |||
280 | --- src/utils/mount.ecryptfs.c 2013-10-25 19:45:09 +0000 | |||
281 | +++ src/utils/mount.ecryptfs.c 2013-10-28 17:50:31 +0000 | |||
282 | @@ -33,6 +33,7 @@ | |||
283 | 33 | #include <sys/mount.h> | 33 | #include <sys/mount.h> |
284 | 34 | #include <sys/stat.h> | 34 | #include <sys/stat.h> |
285 | 35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
286 | 36 | #include <sys/wait.h> | ||
287 | 36 | #include "ecryptfs.h" | 37 | #include "ecryptfs.h" |
288 | 37 | #include "decision_graph.h" | 38 | #include "decision_graph.h" |
289 | 38 | #include "io.h" | 39 | #include "io.h" |
290 | 39 | 40 | ||
291 | === modified file 'src/utils/mount.ecryptfs_private.c' | |||
292 | --- src/utils/mount.ecryptfs_private.c 2013-10-25 21:33:30 +0000 | |||
293 | +++ src/utils/mount.ecryptfs_private.c 2013-10-28 17:50:31 +0000 | |||
294 | @@ -30,6 +30,7 @@ | |||
295 | 30 | #include <sys/param.h> | 30 | #include <sys/param.h> |
296 | 31 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
297 | 32 | #include <sys/types.h> | 32 | #include <sys/types.h> |
298 | 33 | #include <ctype.h> | ||
299 | 33 | #include <errno.h> | 34 | #include <errno.h> |
300 | 34 | #include <keyutils.h> | 35 | #include <keyutils.h> |
301 | 35 | #include <mntent.h> | 36 | #include <mntent.h> |
302 | @@ -51,7 +52,7 @@ | |||
303 | 51 | #define FSTYPE "ecryptfs" | 52 | #define FSTYPE "ecryptfs" |
304 | 52 | #define TMP "/dev/shm" | 53 | #define TMP "/dev/shm" |
305 | 53 | 54 | ||
307 | 54 | int read_config(char *pw_dir, int uid, char *alias, char **s, char **d, char **o) { | 55 | int read_config(char *pw_dir, uid_t uid, char *alias, char **s, char **d, char **o) { |
308 | 55 | /* Read an fstab(5) style config file */ | 56 | /* Read an fstab(5) style config file */ |
309 | 56 | char *fnam; | 57 | char *fnam; |
310 | 57 | struct stat mstat; | 58 | struct stat mstat; |
311 | @@ -91,7 +92,7 @@ | |||
312 | 91 | *s = strdup(e->mnt_fsname); | 92 | *s = strdup(e->mnt_fsname); |
313 | 92 | if (!*s) | 93 | if (!*s) |
314 | 93 | return -2; | 94 | return -2; |
316 | 94 | out: | 95 | |
317 | 95 | return 0; | 96 | return 0; |
318 | 96 | } | 97 | } |
319 | 97 | 98 | ||
320 | @@ -138,7 +139,7 @@ | |||
321 | 138 | char *sig_file; | 139 | char *sig_file; |
322 | 139 | FILE *fh = NULL; | 140 | FILE *fh = NULL; |
323 | 140 | char **sig = NULL; | 141 | char **sig = NULL; |
325 | 141 | int i, j; | 142 | unsigned int i, j; |
326 | 142 | /* Construct sig file name */ | 143 | /* Construct sig file name */ |
327 | 143 | if (asprintf(&sig_file, "%s/.ecryptfs/%s.sig", pw_dir, alias) < 0) { | 144 | if (asprintf(&sig_file, "%s/.ecryptfs/%s.sig", pw_dir, alias) < 0) { |
328 | 144 | perror("asprintf"); | 145 | perror("asprintf"); |
329 | @@ -219,7 +220,7 @@ | |||
330 | 219 | return NULL; | 220 | return NULL; |
331 | 220 | } | 221 | } |
332 | 221 | 222 | ||
334 | 222 | int check_ownership_mnt(int uid, char **mnt) { | 223 | int check_ownership_mnt(uid_t uid, char **mnt) { |
335 | 223 | /* Check ownership of mount point, chdir into it, and | 224 | /* Check ownership of mount point, chdir into it, and |
336 | 224 | * canonicalize the path for use in mtab updating. | 225 | * canonicalize the path for use in mtab updating. |
337 | 225 | * Return 0 if everything is in order, 1 on error. | 226 | * Return 0 if everything is in order, 1 on error. |
338 | @@ -260,7 +261,7 @@ | |||
339 | 260 | } | 261 | } |
340 | 261 | 262 | ||
341 | 262 | 263 | ||
343 | 263 | int check_ownerships(int uid, char *path) { | 264 | int check_ownerships(uid_t uid, char *path) { |
344 | 264 | /* Check ownership of device and mount point. | 265 | /* Check ownership of device and mount point. |
345 | 265 | * Return 0 if everything is in order, 1 on error. | 266 | * Return 0 if everything is in order, 1 on error. |
346 | 266 | */ | 267 | */ |
347 | @@ -372,7 +373,7 @@ | |||
348 | 372 | return 1; | 373 | return 1; |
349 | 373 | } | 374 | } |
350 | 374 | 375 | ||
352 | 375 | FILE *lock_counter(char *u, int uid, char *alias) { | 376 | FILE *lock_counter(char *u, uid_t uid, char *alias) { |
353 | 376 | char *f; | 377 | char *f; |
354 | 377 | int fd; | 378 | int fd; |
355 | 378 | FILE *fh; | 379 | FILE *fh; |
356 | @@ -506,7 +507,9 @@ | |||
357 | 506 | * c) updating /etc/mtab | 507 | * c) updating /etc/mtab |
358 | 507 | */ | 508 | */ |
359 | 508 | int main(int argc, char *argv[]) { | 509 | int main(int argc, char *argv[]) { |
361 | 509 | int uid, gid, mounting; | 510 | uid_t uid; |
362 | 511 | gid_t gid; | ||
363 | 512 | int mounting; | ||
364 | 510 | int force = 0; | 513 | int force = 0; |
365 | 511 | struct passwd *pwd; | 514 | struct passwd *pwd; |
366 | 512 | char *alias, *src, *dest, *opt, *opts2; | 515 | char *alias, *src, *dest, *opt, *opts2; |
367 | 513 | 516 | ||
368 | === modified file 'src/utils/test.c' | |||
369 | --- src/utils/test.c 2013-10-25 19:45:09 +0000 | |||
370 | +++ src/utils/test.c 2013-10-28 17:50:31 +0000 | |||
371 | @@ -103,7 +103,7 @@ | |||
372 | 103 | unsigned long lower_page_idx; | 103 | unsigned long lower_page_idx; |
373 | 104 | int byte_offset; | 104 | int byte_offset; |
374 | 105 | int rc = 0; | 105 | int rc = 0; |
376 | 106 | int i; | 106 | size_t i; |
377 | 107 | 107 | ||
378 | 108 | printf("Testing ecryptfs_extent_to_lwr_pg_idx_and_offset()... "); | 108 | printf("Testing ecryptfs_extent_to_lwr_pg_idx_and_offset()... "); |
379 | 109 | crypt_stat.extent_size = ECRYPTFS_EXTENT_SIZE; | 109 | crypt_stat.extent_size = ECRYPTFS_EXTENT_SIZE; |
380 | @@ -122,14 +122,14 @@ | |||
381 | 122 | if (lower_page_idx | 122 | if (lower_page_idx |
382 | 123 | != translation_test_vector[i].lower_page_idx) { | 123 | != translation_test_vector[i].lower_page_idx) { |
383 | 124 | rc = -1; | 124 | rc = -1; |
385 | 125 | printf("\nError on test vector entry [%d]; " | 125 | printf("\nError on test vector entry [%zu]; " |
386 | 126 | "lower_page_idx = [%lu]\n", i, lower_page_idx); | 126 | "lower_page_idx = [%lu]\n", i, lower_page_idx); |
387 | 127 | goto out; | 127 | goto out; |
388 | 128 | } | 128 | } |
389 | 129 | if (byte_offset | 129 | if (byte_offset |
390 | 130 | != translation_test_vector[i].byte_offset) { | 130 | != translation_test_vector[i].byte_offset) { |
391 | 131 | rc = -1; | 131 | rc = -1; |
393 | 132 | printf("\nError on test vector entry [%d]; " | 132 | printf("\nError on test vector entry [%zd]; " |
394 | 133 | "byte offset = [%d]\n", i, byte_offset); | 133 | "byte offset = [%d]\n", i, byte_offset); |
395 | 134 | goto out; | 134 | goto out; |
396 | 135 | } | 135 | } |
397 | @@ -276,13 +276,13 @@ | |||
398 | 276 | unsigned long extent_offset = 0; | 276 | unsigned long extent_offset = 0; |
399 | 277 | unsigned long lower_page_idx = 0; | 277 | unsigned long lower_page_idx = 0; |
400 | 278 | unsigned long prior_lower_page_idx = 0; | 278 | unsigned long prior_lower_page_idx = 0; |
401 | 279 | unsigned int num_extents_per_page; | ||
402 | 279 | struct page *lower_page; | 280 | struct page *lower_page; |
403 | 280 | struct inode *lower_inode; | 281 | struct inode *lower_inode; |
404 | 281 | struct ecryptfs_crypt_stat *crypt_stat; | 282 | struct ecryptfs_crypt_stat *crypt_stat; |
405 | 282 | int rc = 0; | 283 | int rc = 0; |
407 | 283 | int lower_byte_offset; | 284 | int lower_byte_offset = 0; |
408 | 284 | int orig_byte_offset = 0; | 285 | int orig_byte_offset = 0; |
409 | 285 | int num_extents_per_page; | ||
410 | 286 | #define ECRYPTFS_PAGE_STATE_UNREAD 0 | 286 | #define ECRYPTFS_PAGE_STATE_UNREAD 0 |
411 | 287 | #define ECRYPTFS_PAGE_STATE_READ 1 | 287 | #define ECRYPTFS_PAGE_STATE_READ 1 |
412 | 288 | #define ECRYPTFS_PAGE_STATE_MODIFIED 2 | 288 | #define ECRYPTFS_PAGE_STATE_MODIFIED 2 |
413 | @@ -410,7 +410,7 @@ | |||
414 | 410 | int rc = 0; | 410 | int rc = 0; |
415 | 411 | unsigned long lower_size; | 411 | unsigned long lower_size; |
416 | 412 | struct ecryptfs_crypt_stat crypt_stat; | 412 | struct ecryptfs_crypt_stat crypt_stat; |
418 | 413 | int i; | 413 | size_t i; |
419 | 414 | 414 | ||
420 | 415 | for (i = 0; | 415 | for (i = 0; |
421 | 416 | i < (sizeof(upper_lower_test_vector) | 416 | i < (sizeof(upper_lower_test_vector) |
422 | 417 | 417 | ||
423 | === modified file 'tests/kernel/directory-concurrent/test.c' | |||
424 | --- tests/kernel/directory-concurrent/test.c 2012-02-02 15:04:32 +0000 | |||
425 | +++ tests/kernel/directory-concurrent/test.c 2013-10-28 17:50:31 +0000 | |||
426 | @@ -149,7 +149,7 @@ | |||
427 | 149 | 149 | ||
428 | 150 | int test_dirs(const char *path, const int max_dirs) | 150 | int test_dirs(const char *path, const int max_dirs) |
429 | 151 | { | 151 | { |
431 | 152 | int i, j; | 152 | int i; |
432 | 153 | char *filename; | 153 | char *filename; |
433 | 154 | size_t len = strlen(path) + 32; | 154 | size_t len = strlen(path) + 32; |
434 | 155 | int ret = TEST_PASSED; | 155 | int ret = TEST_PASSED; |
435 | 156 | 156 | ||
436 | === modified file 'tests/kernel/enospc/test.c' | |||
437 | --- tests/kernel/enospc/test.c 2013-10-25 22:51:40 +0000 | |||
438 | +++ tests/kernel/enospc/test.c 2013-10-28 17:50:31 +0000 | |||
439 | @@ -38,7 +38,6 @@ | |||
440 | 38 | int test_exercise(char *filename, off_t size) | 38 | int test_exercise(char *filename, off_t size) |
441 | 39 | { | 39 | { |
442 | 40 | int fd; | 40 | int fd; |
443 | 41 | struct stat statbuf; | ||
444 | 42 | int ret = TEST_FAILED; | 41 | int ret = TEST_FAILED; |
445 | 43 | unsigned char buff[BUFF_SZ]; | 42 | unsigned char buff[BUFF_SZ]; |
446 | 44 | 43 | ||
447 | 45 | 44 | ||
448 | === modified file 'tests/kernel/extend-file-random/test.c' | |||
449 | --- tests/kernel/extend-file-random/test.c 2013-10-25 23:14:23 +0000 | |||
450 | +++ tests/kernel/extend-file-random/test.c 2013-10-28 17:50:31 +0000 | |||
451 | @@ -42,32 +42,46 @@ | |||
452 | 42 | 42 | ||
453 | 43 | int test_write(int fd, char *buffer, size_t len, off_t offset) | 43 | int test_write(int fd, char *buffer, size_t len, off_t offset) |
454 | 44 | { | 44 | { |
455 | 45 | ssize_t rc; | ||
456 | 46 | |||
457 | 45 | if (lseek(fd, offset, SEEK_SET) < 0) { | 47 | if (lseek(fd, offset, SEEK_SET) < 0) { |
458 | 46 | fprintf(stderr, "Failed to seek to position %jd: %s\n", | 48 | fprintf(stderr, "Failed to seek to position %jd: %s\n", |
459 | 47 | (intmax_t)offset, strerror(errno)); | 49 | (intmax_t)offset, strerror(errno)); |
460 | 48 | return TEST_FAILED; | 50 | return TEST_FAILED; |
461 | 49 | } | 51 | } |
462 | 50 | 52 | ||
464 | 51 | if (write(fd, buffer, len) != len) { | 53 | rc = write(fd, buffer, len); |
465 | 54 | if (rc < 0) { | ||
466 | 52 | fprintf(stderr, "Failed to write %zu bytes, position %jd: %s\n", | 55 | fprintf(stderr, "Failed to write %zu bytes, position %jd: %s\n", |
467 | 53 | len, (intmax_t)offset, strerror(errno)); | 56 | len, (intmax_t)offset, strerror(errno)); |
468 | 54 | return TEST_FAILED; | 57 | return TEST_FAILED; |
469 | 58 | } else if (((size_t)rc) < len) { | ||
470 | 59 | fprintf(stderr, "Failed to write %zu bytes, position %jd: short write of %zd bytes\n", | ||
471 | 60 | len, (intmax_t)offset, rc); | ||
472 | 61 | return TEST_FAILED; | ||
473 | 55 | } | 62 | } |
474 | 56 | return TEST_PASSED; | 63 | return TEST_PASSED; |
475 | 57 | } | 64 | } |
476 | 58 | 65 | ||
477 | 59 | int test_read(int fd, char *buffer, size_t len, off_t offset) | 66 | int test_read(int fd, char *buffer, size_t len, off_t offset) |
478 | 60 | { | 67 | { |
479 | 68 | ssize_t rc; | ||
480 | 69 | |||
481 | 61 | if (lseek(fd, offset, SEEK_SET) < 0) { | 70 | if (lseek(fd, offset, SEEK_SET) < 0) { |
482 | 62 | fprintf(stderr, "Failed to seek to position %jd: %s\n", | 71 | fprintf(stderr, "Failed to seek to position %jd: %s\n", |
483 | 63 | (intmax_t)offset, strerror(errno)); | 72 | (intmax_t)offset, strerror(errno)); |
484 | 64 | return TEST_FAILED; | 73 | return TEST_FAILED; |
485 | 65 | } | 74 | } |
486 | 66 | 75 | ||
488 | 67 | if (read(fd, buffer, len) != len) { | 76 | rc = read(fd, buffer, len); |
489 | 77 | if (rc < 0) { | ||
490 | 68 | fprintf(stderr, "Failed to read %zu bytes, position %jd: %s\n", | 78 | fprintf(stderr, "Failed to read %zu bytes, position %jd: %s\n", |
491 | 69 | len, (intmax_t)offset, strerror(errno)); | 79 | len, (intmax_t)offset, strerror(errno)); |
492 | 70 | return TEST_FAILED; | 80 | return TEST_FAILED; |
493 | 81 | } else if (((size_t)rc) < len) { | ||
494 | 82 | fprintf(stderr, "Failed to read %zu bytes, position %jd: short read of %zd bytes\n", | ||
495 | 83 | len, (intmax_t)offset, rc); | ||
496 | 84 | return TEST_FAILED; | ||
497 | 71 | } | 85 | } |
498 | 72 | return TEST_PASSED; | 86 | return TEST_PASSED; |
499 | 73 | } | 87 | } |
500 | 74 | 88 | ||
501 | === modified file 'tests/kernel/file-concurrent/test.c' | |||
502 | --- tests/kernel/file-concurrent/test.c 2012-03-08 17:31:44 +0000 | |||
503 | +++ tests/kernel/file-concurrent/test.c 2013-10-28 17:50:31 +0000 | |||
504 | @@ -177,7 +177,7 @@ | |||
505 | 177 | 177 | ||
506 | 178 | int test_files(const char *path, const int max_files) | 178 | int test_files(const char *path, const int max_files) |
507 | 179 | { | 179 | { |
509 | 180 | int i, j; | 180 | int i; |
510 | 181 | char *filename; | 181 | char *filename; |
511 | 182 | size_t len = strlen(path) + 32; | 182 | size_t len = strlen(path) + 32; |
512 | 183 | int ret = TEST_PASSED; | 183 | int ret = TEST_PASSED; |
513 | 184 | 184 | ||
514 | === modified file 'tests/kernel/inode-race-stat/test.c' | |||
515 | --- tests/kernel/inode-race-stat/test.c 2013-03-13 14:55:11 +0000 | |||
516 | +++ tests/kernel/inode-race-stat/test.c 2013-10-28 17:50:31 +0000 | |||
517 | @@ -107,7 +107,6 @@ | |||
518 | 107 | { | 107 | { |
519 | 108 | for (;;) { | 108 | for (;;) { |
520 | 109 | int n; | 109 | int n; |
521 | 110 | int ret; | ||
522 | 111 | char cmd[32]; | 110 | char cmd[32]; |
523 | 112 | 111 | ||
524 | 113 | if ((n = read(fdin, cmd, sizeof(cmd))) < 1) { | 112 | if ((n = read(fdin, cmd, sizeof(cmd))) < 1) { |
525 | @@ -362,9 +361,9 @@ | |||
526 | 362 | cmd[0] = CMD_QUIT; | 361 | cmd[0] = CMD_QUIT; |
527 | 363 | for (i = 0; i < threads; i++) { | 362 | for (i = 0; i < threads; i++) { |
528 | 364 | int status; | 363 | int status; |
529 | 365 | int ret; | ||
530 | 366 | 364 | ||
532 | 367 | ret = write(pipe_to[i][1], cmd, 1); | 365 | if (write(pipe_to[i][1], cmd, 1) != 1) |
533 | 366 | continue; | ||
534 | 368 | (void)waitpid(pids[i], &status, 0); | 367 | (void)waitpid(pids[i], &status, 0); |
535 | 369 | 368 | ||
536 | 370 | (void)close(pipe_to[i][1]); | 369 | (void)close(pipe_to[i][1]); |
537 | 371 | 370 | ||
538 | === modified file 'tests/kernel/inotify/test.c' | |||
539 | --- tests/kernel/inotify/test.c 2013-06-06 07:58:30 +0000 | |||
540 | +++ tests/kernel/inotify/test.c 2013-10-28 17:50:31 +0000 | |||
541 | @@ -195,7 +195,7 @@ | |||
542 | 195 | * mk_filename() | 195 | * mk_filename() |
543 | 196 | * simple helper to create a filename | 196 | * simple helper to create a filename |
544 | 197 | */ | 197 | */ |
546 | 198 | void inline mk_filename(char *filename, size_t len, const char *path, const char *name) | 198 | inline void mk_filename(char *filename, size_t len, const char *path, const char *name) |
547 | 199 | { | 199 | { |
548 | 200 | snprintf(filename, len, "%s/%s", path, name); | 200 | snprintf(filename, len, "%s/%s", path, name); |
549 | 201 | } | 201 | } |
550 | 202 | 202 | ||
551 | === modified file 'tests/kernel/lp-509180/test.c' | |||
552 | --- tests/kernel/lp-509180/test.c 2012-03-01 15:55:22 +0000 | |||
553 | +++ tests/kernel/lp-509180/test.c 2013-10-28 17:50:31 +0000 | |||
554 | @@ -48,7 +48,6 @@ | |||
555 | 48 | int fd; | 48 | int fd; |
556 | 49 | int opt, flags = 0; | 49 | int opt, flags = 0; |
557 | 50 | int rc = 0; | 50 | int rc = 0; |
558 | 51 | unsigned int *ptr; | ||
559 | 52 | char *file; | 51 | char *file; |
560 | 53 | unsigned char buffer[1]; | 52 | unsigned char buffer[1]; |
561 | 54 | 53 | ||
562 | 55 | 54 | ||
563 | === modified file 'tests/kernel/trunc-file/test.c' | |||
564 | --- tests/kernel/trunc-file/test.c 2013-07-05 14:56:30 +0000 | |||
565 | +++ tests/kernel/trunc-file/test.c 2013-10-28 17:50:31 +0000 | |||
566 | @@ -39,7 +39,7 @@ | |||
567 | 39 | 39 | ||
568 | 40 | int write_buff(int fd, unsigned char *data, ssize_t size) | 40 | int write_buff(int fd, unsigned char *data, ssize_t size) |
569 | 41 | { | 41 | { |
571 | 42 | char *ptr = data; | 42 | unsigned char *ptr = data; |
572 | 43 | ssize_t n; | 43 | ssize_t n; |
573 | 44 | ssize_t sz = size; | 44 | ssize_t sz = size; |
574 | 45 | 45 | ||
575 | @@ -55,7 +55,7 @@ | |||
576 | 55 | 55 | ||
577 | 56 | int read_buff(int fd, unsigned char *data, ssize_t size) | 56 | int read_buff(int fd, unsigned char *data, ssize_t size) |
578 | 57 | { | 57 | { |
580 | 58 | char *ptr = data; | 58 | unsigned char *ptr = data; |
581 | 59 | ssize_t n; | 59 | ssize_t n; |
582 | 60 | ssize_t sz = size; | 60 | ssize_t sz = size; |
583 | 61 | 61 | ||
584 | @@ -159,9 +159,6 @@ | |||
585 | 159 | int test_exercise(char *filename, ssize_t size) | 159 | int test_exercise(char *filename, ssize_t size) |
586 | 160 | { | 160 | { |
587 | 161 | int fd; | 161 | int fd; |
588 | 162 | ssize_t i; | ||
589 | 163 | ssize_t n; | ||
590 | 164 | ssize_t buflen; | ||
591 | 165 | int ret = TEST_FAILED; | 162 | int ret = TEST_FAILED; |
592 | 166 | ssize_t trunc_size = size / 2; | 163 | ssize_t trunc_size = size / 2; |
593 | 167 | struct stat statbuf; | 164 | struct stat statbuf; |
594 | @@ -257,8 +254,6 @@ | |||
595 | 257 | { | 254 | { |
596 | 258 | ssize_t len = DEFAULT_SIZE; | 255 | ssize_t len = DEFAULT_SIZE; |
597 | 259 | const ssize_t max_len = SSIZE_MAX / 1024; | 256 | const ssize_t max_len = SSIZE_MAX / 1024; |
598 | 260 | int i; | ||
599 | 261 | int ret; | ||
600 | 262 | 257 | ||
601 | 263 | if (argc < 2) { | 258 | if (argc < 2) { |
602 | 264 | fprintf(stderr, "Syntax: %s filename [size_in_K]\n", argv[0]); | 259 | fprintf(stderr, "Syntax: %s filename [size_in_K]\n", argv[0]); |
603 | 265 | 260 | ||
604 | === modified file 'tests/userspace/wrap-unwrap/test.c' | |||
605 | --- tests/userspace/wrap-unwrap/test.c 2013-06-05 18:29:54 +0000 | |||
606 | +++ tests/userspace/wrap-unwrap/test.c 2013-10-28 17:50:31 +0000 | |||
607 | @@ -19,7 +19,7 @@ | |||
608 | 19 | int decrypted_passphrase_size; | 19 | int decrypted_passphrase_size; |
609 | 20 | char salt[ECRYPTFS_SALT_SIZE + 1]; | 20 | char salt[ECRYPTFS_SALT_SIZE + 1]; |
610 | 21 | char *path; | 21 | char *path; |
612 | 22 | int i, j; | 22 | int i; |
613 | 23 | int rc = 0; | 23 | int rc = 0; |
614 | 24 | 24 | ||
615 | 25 | if (argc != 2) { | 25 | if (argc != 2) { |
Note that the "Unmerged revisions" section below isn't showing all of the revisions. It is missing the descriptions for r800 through r804. I'm sure you can look at the proposed branch, but here's a quick paste of those revision descriptions:
------- ------- ------- ------- ------- ------- ------- ------- ---- ------- ------- ------- ------- ------- ------- ------- ---- ------- ------- ------- ------- ------- ------- ------- ---- ------- ------- ------- ------- ------- ------- ------- ---- ------- ------- ------- ------- ------- ------- ------- ---- ------- ------- ------- ------- ------- ------- ------- ----
revno: 804
Fix some of the signed and unsigned int comparisons (-Wsign-compare)
-------
revno: 803
Fix -Wempty-body warning
-------
revno: 802
Remove the unused 'order' member of the supported_key_bytes struct
-------
revno: 801
Fix sign comparison warnings and other issues surrounding the uint32_t type
used for key_bytes
-------
revno: 800
Fix 'unused variable' warnings
-------