Merge lp:~tyhicks/ecryptfs/fix-most-Wall-and-Wextra-warnings into lp:ecryptfs

Proposed by Tyler Hicks
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
Reviewer Review Type Date Requested Status
Colin Ian King (community) Approve
Review via email: mp+192913@code.launchpad.net

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/testing/reviewing new commits.

What's left is:

[-Wmissing-field-initializers]
[-Wunused-parameter]
[-Wunused-result]

I'll fix those remaining three very soon. I just didn't get to them before
Monday rolled around.

To post a comment you must log in.
Revision history for this message
Tyler Hicks (tyhicks) wrote :

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
------------------------------------------------------------

Revision history for this message
Colin Ian King (colin-king) wrote :

These look good to me. I've run them through Coverity Scan too and it looks fine.

review: Approve
Revision history for this message
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.

Revision history for this message
Colin Ian King (colin-king) wrote :

Ah, I didn't spot that, so much for my careful reviewing :-/

Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/libecryptfs/ecryptfs-stat.c'
--- src/libecryptfs/ecryptfs-stat.c 2013-03-13 14:52:43 +0000
+++ src/libecryptfs/ecryptfs-stat.c 2013-10-28 17:50:31 +0000
@@ -80,7 +80,7 @@
80 char *buf, int *bytes_read)80 char *buf, int *bytes_read)
81{81{
82 int rc = 0;82 int rc = 0;
83 int i;83 size_t i;
84 uint32_t flags;84 uint32_t flags;
85 int big_endian;85 int big_endian;
8686
8787
=== modified file 'src/libecryptfs/key_management.c'
--- src/libecryptfs/key_management.c 2013-10-25 19:45:09 +0000
+++ src/libecryptfs/key_management.c 2013-10-28 17:50:31 +0000
@@ -247,7 +247,6 @@
247 int rc = 0;247 int rc = 0;
248 ssize_t size;248 ssize_t size;
249 int fd;249 int fd;
250 int i;
251 char *p = NULL;250 char *p = NULL;
252 char decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1];251 char decrypted_passphrase[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1];
253252
254253
=== modified file 'src/libecryptfs/miscdev.c'
--- src/libecryptfs/miscdev.c 2013-10-25 19:45:09 +0000
+++ src/libecryptfs/miscdev.c 2013-10-28 17:50:31 +0000
@@ -153,7 +153,7 @@
153 packet_len = 0;153 packet_len = 0;
154 }154 }
155 miscdev_msg_data_size = (1 + 4 + packet_len_size + packet_len);155 miscdev_msg_data_size = (1 + 4 + packet_len_size + packet_len);
156 if (miscdev_msg_data_size != read_bytes) {156 if (miscdev_msg_data_size != (size_t)read_bytes) {
157 rc = -EINVAL;157 rc = -EINVAL;
158 syslog(LOG_ERR, "%s: Invalid packet. (1 + 4 + "158 syslog(LOG_ERR, "%s: Invalid packet. (1 + 4 + "
159 "packet_len_size=[%zu] + packet_len=[%zu])=[%zu] != "159 "packet_len_size=[%zu] + packet_len=[%zu])=[%zu] != "
160160
=== modified file 'src/libecryptfs/module_mgr.c'
--- src/libecryptfs/module_mgr.c 2013-10-25 19:45:09 +0000
+++ src/libecryptfs/module_mgr.c 2013-10-28 17:50:31 +0000
@@ -23,6 +23,8 @@
23#include <string.h>23#include <string.h>
24#include <stdlib.h>24#include <stdlib.h>
25#include <stdio.h>25#include <stdio.h>
26#include <stdint.h>
27#include <inttypes.h>
26#include "../include/ecryptfs.h"28#include "../include/ecryptfs.h"
27#include "../include/decision_graph.h"29#include "../include/decision_graph.h"
2830
@@ -265,8 +267,9 @@
265 } else if (node->val) {267 } else if (node->val) {
266 if (yn < 0)268 if (yn < 0)
267 rc = WRONG_VALUE;269 rc = WRONG_VALUE;
268 } else270 } else {
269 /* default: no */;271 /* default: no */;
272 }
270out_free:273out_free:
271 if (node->val) {274 if (node->val) {
272 free(node->val);275 free(node->val);
@@ -389,33 +392,32 @@
389static struct supported_key_bytes {392static struct supported_key_bytes {
390 char *cipher_name;393 char *cipher_name;
391 uint32_t key_bytes;394 uint32_t key_bytes;
392 uint32_t order;
393} supported_key_bytes[] = {395} supported_key_bytes[] = {
394 {"aes", 16, 1},396 {"aes", 16},
395 {"aes", 32, 2},397 {"aes", 32},
396 {"aes", 24, 3},398 {"aes", 24},
397 {"anubis", 16, 1},399 {"anubis", 16},
398 {"anubis", 32, 2},400 {"anubis", 32},
399 {"des3_ede", 24, 1},401 {"des3_ede", 24},
400 {"serpent", 16, 1},402 {"serpent", 16},
401 {"serpent", 32, 2},403 {"serpent", 32},
402 {"tnepres", 16, 1},404 {"tnepres", 16},
403 {"tnepres", 32, 2},405 {"tnepres", 32},
404 {"tea", 16, 1},406 {"tea", 16},
405 {"xeta", 16, 1},407 {"xeta", 16},
406 {"xtea", 16, 1},408 {"xtea", 16},
407 {"cast5", 16, 1},409 {"cast5", 16},
408 {"cast6", 16, 1},410 {"cast6", 16},
409 {"cast6", 32, 2},411 {"cast6", 32},
410 {"twofish", 16, 1},412 {"twofish", 16},
411 {"twofish", 32, 2},413 {"twofish", 32},
412 {"blowfish", 16, 1},414 {"blowfish", 16},
413 {"blowfish", 32, 2},415 {"blowfish", 32},
414 {"blowfish", 56, 2},416 {"blowfish", 56},
415 {"khazad", 16, 1},417 {"khazad", 16},
416 {"arc4", 16, 1},418 {"arc4", 16},
417 {"arc4", 32, 2},419 {"arc4", 32},
418 {NULL, 0, 0}420 {NULL, 0}
419};421};
420422
421static int tf_ecryptfs_key_bytes(struct ecryptfs_ctx *ctx,423static int tf_ecryptfs_key_bytes(struct ecryptfs_ctx *ctx,
@@ -438,7 +440,7 @@
438}440}
439441
440static int init_ecryptfs_key_bytes_param_node(char *cipher_name, 442static int init_ecryptfs_key_bytes_param_node(char *cipher_name,
441 int min, int max)443 uint32_t min, uint32_t max)
442{444{
443 int i;445 int i;
444 int rc = 0;446 int rc = 0;
@@ -453,7 +455,7 @@
453 455
454 tn = &ecryptfs_key_bytes_param_node.tl[456 tn = &ecryptfs_key_bytes_param_node.tl[
455 ecryptfs_key_bytes_param_node.num_transitions];457 ecryptfs_key_bytes_param_node.num_transitions];
456 rc = asprintf(&tn->val, "%d",458 rc = asprintf(&tn->val, "%"PRIu32,
457 supported_key_bytes[i].key_bytes);459 supported_key_bytes[i].key_bytes);
458 if (rc == -1) {460 if (rc == -1) {
459 rc = -ENOMEM;461 rc = -ENOMEM;
@@ -462,7 +464,7 @@
462 rc = 0;464 rc = 0;
463 if (!ecryptfs_key_bytes_param_node.suggested_val) {465 if (!ecryptfs_key_bytes_param_node.suggested_val) {
464 rc = asprintf(&ecryptfs_key_bytes_param_node.suggested_val,466 rc = asprintf(&ecryptfs_key_bytes_param_node.suggested_val,
465 "%d",467 "%"PRIu32,
466 supported_key_bytes[i].key_bytes);468 supported_key_bytes[i].key_bytes);
467 if (rc == -1) {469 if (rc == -1) {
468 rc = -ENOMEM;470 rc = -ENOMEM;
@@ -485,12 +487,33 @@
485 return rc;487 return rc;
486}488}
487489
490static int parse_key_bytes(uint32_t *bytes, const char *str)
491{
492 uintmax_t tmp;
493 char *eptr;
494
495 if (str[0] == '-')
496 return -ERANGE;
497
498 errno = 0;
499 tmp = strtoumax(str, &eptr, 10);
500 if (eptr == str)
501 return -EINVAL;
502 else if (tmp == UINT_MAX && errno == ERANGE)
503 return -ERANGE;
504 else if (tmp > UINT32_MAX)
505 return -ERANGE;
506
507 *bytes = (uint32_t)tmp;
508 return 0;
509}
510
488static int tf_ecryptfs_cipher(struct ecryptfs_ctx *ctx, struct param_node *node,511static int tf_ecryptfs_cipher(struct ecryptfs_ctx *ctx, struct param_node *node,
489 struct val_node **head, void **foo)512 struct val_node **head, void **foo)
490{513{
491 char *opt;514 char *opt;
492 int rc;515 int rc;
493 int min = 0, max = 999999;516 uint32_t min = 0, max = 999999;
494 struct val_node *tmp = *head, *tmpprev = NULL;517 struct val_node *tmp = *head, *tmpprev = NULL;
495518
496 while (tmp) {519 while (tmp) {
@@ -498,18 +521,16 @@
498 int popval = 0;521 int popval = 0;
499 if (tmp->val && (strstr(tmp->val,"max_key_bytes=") != NULL) && 522 if (tmp->val && (strstr(tmp->val,"max_key_bytes=") != NULL) &&
500 ((ptr=strchr(tmp->val,'=')) != NULL)) {523 ((ptr=strchr(tmp->val,'=')) != NULL)) {
501 char *eptr;524 rc = parse_key_bytes(&max, ++ptr);
502 max = strtol(++ptr, &eptr, 10);525 if (rc)
503 if (eptr == ptr)526 return rc;
504 return -EINVAL;
505 popval = 1;527 popval = 1;
506 }528 }
507 if (tmp->val && (strstr(tmp->val,"min_key_bytes=") != NULL) && 529 if (tmp->val && (strstr(tmp->val,"min_key_bytes=") != NULL) &&
508 ((ptr=strchr(tmp->val,'=')) != NULL)) {530 ((ptr=strchr(tmp->val,'=')) != NULL)) {
509 char *eptr;531 rc = parse_key_bytes(&min, ++ptr);
510 min = strtol(++ptr, &eptr, 10);532 if (rc)
511 if (eptr == ptr)533 return rc;
512 return -EINVAL;
513 popval = 1;534 popval = 1;
514 }535 }
515 if (popval) {536 if (popval) {
516537
=== modified file 'src/pam_ecryptfs/pam_ecryptfs.c'
--- src/pam_ecryptfs/pam_ecryptfs.c 2013-10-25 19:45:09 +0000
+++ src/pam_ecryptfs/pam_ecryptfs.c 2013-10-28 17:50:31 +0000
@@ -46,31 +46,6 @@
4646
47#define PRIVATE_DIR "Private"47#define PRIVATE_DIR "Private"
4848
49static void error(const char *msg)
50{
51 syslog(LOG_ERR, "pam_ecryptfs: errno = [%i]; strerror = [%m]\n", errno);
52 switch (errno) {
53 case ENOKEY:
54 syslog(LOG_ERR, "pam_ecryptfs: %s: Requested key not available\n", msg);
55 return;
56
57 case EKEYEXPIRED:
58 syslog(LOG_ERR, "pam_ecryptfs: %s: Key has expired\n", msg);
59 return;
60
61 case EKEYREVOKED:
62 syslog(LOG_ERR, "pam_ecryptfs: %s: Key has been revoked\n", msg);
63 return;
64
65 case EKEYREJECTED:
66 syslog(LOG_ERR, "pam_ecryptfs: %s: Key was rejected by service\n", msg);
67 return;
68 default:
69 syslog(LOG_ERR, "pam_ecryptfs: %s: Unknown key error\n", msg);
70 return;
71 }
72}
73
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 */
75static int file_exists_dotecryptfs(const char *homedir, char *filename)50static int file_exists_dotecryptfs(const char *homedir, char *filename)
76{51{
@@ -211,8 +186,6 @@
211 if ((argc == 1)186 if ((argc == 1)
212 && (memcmp(argv[0], "unwrap\0", 7) == 0)) {187 && (memcmp(argv[0], "unwrap\0", 7) == 0)) {
213 char *wrapped_pw_filename;188 char *wrapped_pw_filename;
214 char *unwrapped_pw_filename;
215 struct stat s;
216189
217 rc = asprintf(190 rc = asprintf(
218 &wrapped_pw_filename, "%s/.ecryptfs/%s",191 &wrapped_pw_filename, "%s/.ecryptfs/%s",
@@ -306,8 +279,6 @@
306 char *autoumount = "auto-umount";279 char *autoumount = "auto-umount";
307 struct stat s;280 struct stat s;
308 pid_t pid;281 pid_t pid;
309 struct utmp *u;
310 int count = 0;
311282
312 if ((pwd = fetch_pwd(pamh)) == NULL) {283 if ((pwd = fetch_pwd(pamh)) == NULL) {
313 /* fetch_pwd() logged a message */284 /* fetch_pwd() logged a message */
@@ -433,7 +404,6 @@
433 char *old_passphrase = NULL;404 char *old_passphrase = NULL;
434 char *new_passphrase = NULL;405 char *new_passphrase = NULL;
435 char *wrapped_pw_filename;406 char *wrapped_pw_filename;
436 char *name = NULL;
437 char salt[ECRYPTFS_SALT_SIZE];407 char salt[ECRYPTFS_SALT_SIZE];
438 char salt_hex[ECRYPTFS_SALT_SIZE_HEX];408 char salt_hex[ECRYPTFS_SALT_SIZE_HEX];
439 pid_t child_pid, tmp_pid;409 pid_t child_pid, tmp_pid;
@@ -448,7 +418,6 @@
448 uid = pwd->pw_uid;418 uid = pwd->pw_uid;
449 gid = pwd->pw_gid;419 gid = pwd->pw_gid;
450 homedir = pwd->pw_dir;420 homedir = pwd->pw_dir;
451 name = pwd->pw_name;
452 }421 }
453 } else {422 } else {
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);
455424
=== modified file 'src/utils/mount.ecryptfs.c'
--- src/utils/mount.ecryptfs.c 2013-10-25 19:45:09 +0000
+++ src/utils/mount.ecryptfs.c 2013-10-28 17:50:31 +0000
@@ -33,6 +33,7 @@
33#include <sys/mount.h>33#include <sys/mount.h>
34#include <sys/stat.h>34#include <sys/stat.h>
35#include <sys/types.h>35#include <sys/types.h>
36#include <sys/wait.h>
36#include "ecryptfs.h"37#include "ecryptfs.h"
37#include "decision_graph.h"38#include "decision_graph.h"
38#include "io.h"39#include "io.h"
3940
=== modified file 'src/utils/mount.ecryptfs_private.c'
--- src/utils/mount.ecryptfs_private.c 2013-10-25 21:33:30 +0000
+++ src/utils/mount.ecryptfs_private.c 2013-10-28 17:50:31 +0000
@@ -30,6 +30,7 @@
30#include <sys/param.h>30#include <sys/param.h>
31#include <sys/stat.h>31#include <sys/stat.h>
32#include <sys/types.h>32#include <sys/types.h>
33#include <ctype.h>
33#include <errno.h>34#include <errno.h>
34#include <keyutils.h>35#include <keyutils.h>
35#include <mntent.h>36#include <mntent.h>
@@ -51,7 +52,7 @@
51#define FSTYPE "ecryptfs"52#define FSTYPE "ecryptfs"
52#define TMP "/dev/shm"53#define TMP "/dev/shm"
5354
54int read_config(char *pw_dir, int uid, char *alias, char **s, char **d, char **o) {55int read_config(char *pw_dir, uid_t uid, char *alias, char **s, char **d, char **o) {
55/* Read an fstab(5) style config file */56/* Read an fstab(5) style config file */
56 char *fnam;57 char *fnam;
57 struct stat mstat;58 struct stat mstat;
@@ -91,7 +92,7 @@
91 *s = strdup(e->mnt_fsname);92 *s = strdup(e->mnt_fsname);
92 if (!*s)93 if (!*s)
93 return -2;94 return -2;
94out:95
95 return 0;96 return 0;
96}97}
9798
@@ -138,7 +139,7 @@
138 char *sig_file;139 char *sig_file;
139 FILE *fh = NULL;140 FILE *fh = NULL;
140 char **sig = NULL;141 char **sig = NULL;
141 int i, j;142 unsigned int i, j;
142 /* Construct sig file name */143 /* Construct sig file name */
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) {
144 perror("asprintf");145 perror("asprintf");
@@ -219,7 +220,7 @@
219 return NULL;220 return NULL;
220}221}
221222
222int check_ownership_mnt(int uid, char **mnt) {223int check_ownership_mnt(uid_t uid, char **mnt) {
223/* Check ownership of mount point, chdir into it, and224/* Check ownership of mount point, chdir into it, and
224 * canonicalize the path for use in mtab updating.225 * canonicalize the path for use in mtab updating.
225 * Return 0 if everything is in order, 1 on error.226 * Return 0 if everything is in order, 1 on error.
@@ -260,7 +261,7 @@
260}261}
261262
262263
263int check_ownerships(int uid, char *path) {264int check_ownerships(uid_t uid, char *path) {
264/* Check ownership of device and mount point.265/* Check ownership of device and mount point.
265 * Return 0 if everything is in order, 1 on error.266 * Return 0 if everything is in order, 1 on error.
266 */267 */
@@ -372,7 +373,7 @@
372 return 1;373 return 1;
373}374}
374375
375FILE *lock_counter(char *u, int uid, char *alias) {376FILE *lock_counter(char *u, uid_t uid, char *alias) {
376 char *f;377 char *f;
377 int fd;378 int fd;
378 FILE *fh;379 FILE *fh;
@@ -506,7 +507,9 @@
506 * c) updating /etc/mtab507 * c) updating /etc/mtab
507 */508 */
508int main(int argc, char *argv[]) {509int main(int argc, char *argv[]) {
509 int uid, gid, mounting;510 uid_t uid;
511 gid_t gid;
512 int mounting;
510 int force = 0;513 int force = 0;
511 struct passwd *pwd;514 struct passwd *pwd;
512 char *alias, *src, *dest, *opt, *opts2;515 char *alias, *src, *dest, *opt, *opts2;
513516
=== modified file 'src/utils/test.c'
--- src/utils/test.c 2013-10-25 19:45:09 +0000
+++ src/utils/test.c 2013-10-28 17:50:31 +0000
@@ -103,7 +103,7 @@
103 unsigned long lower_page_idx;103 unsigned long lower_page_idx;
104 int byte_offset;104 int byte_offset;
105 int rc = 0;105 int rc = 0;
106 int i;106 size_t i;
107107
108 printf("Testing ecryptfs_extent_to_lwr_pg_idx_and_offset()... ");108 printf("Testing ecryptfs_extent_to_lwr_pg_idx_and_offset()... ");
109 crypt_stat.extent_size = ECRYPTFS_EXTENT_SIZE;109 crypt_stat.extent_size = ECRYPTFS_EXTENT_SIZE;
@@ -122,14 +122,14 @@
122 if (lower_page_idx122 if (lower_page_idx
123 != translation_test_vector[i].lower_page_idx) {123 != translation_test_vector[i].lower_page_idx) {
124 rc = -1;124 rc = -1;
125 printf("\nError on test vector entry [%d]; "125 printf("\nError on test vector entry [%zu]; "
126 "lower_page_idx = [%lu]\n", i, lower_page_idx);126 "lower_page_idx = [%lu]\n", i, lower_page_idx);
127 goto out;127 goto out;
128 }128 }
129 if (byte_offset129 if (byte_offset
130 != translation_test_vector[i].byte_offset) {130 != translation_test_vector[i].byte_offset) {
131 rc = -1;131 rc = -1;
132 printf("\nError on test vector entry [%d]; "132 printf("\nError on test vector entry [%zd]; "
133 "byte offset = [%d]\n", i, byte_offset);133 "byte offset = [%d]\n", i, byte_offset);
134 goto out;134 goto out;
135 }135 }
@@ -276,13 +276,13 @@
276 unsigned long extent_offset = 0;276 unsigned long extent_offset = 0;
277 unsigned long lower_page_idx = 0;277 unsigned long lower_page_idx = 0;
278 unsigned long prior_lower_page_idx = 0;278 unsigned long prior_lower_page_idx = 0;
279 unsigned int num_extents_per_page;
279 struct page *lower_page;280 struct page *lower_page;
280 struct inode *lower_inode;281 struct inode *lower_inode;
281 struct ecryptfs_crypt_stat *crypt_stat;282 struct ecryptfs_crypt_stat *crypt_stat;
282 int rc = 0;283 int rc = 0;
283 int lower_byte_offset;284 int lower_byte_offset = 0;
284 int orig_byte_offset = 0;285 int orig_byte_offset = 0;
285 int num_extents_per_page;
286#define ECRYPTFS_PAGE_STATE_UNREAD 0286#define ECRYPTFS_PAGE_STATE_UNREAD 0
287#define ECRYPTFS_PAGE_STATE_READ 1287#define ECRYPTFS_PAGE_STATE_READ 1
288#define ECRYPTFS_PAGE_STATE_MODIFIED 2288#define ECRYPTFS_PAGE_STATE_MODIFIED 2
@@ -410,7 +410,7 @@
410 int rc = 0;410 int rc = 0;
411 unsigned long lower_size;411 unsigned long lower_size;
412 struct ecryptfs_crypt_stat crypt_stat;412 struct ecryptfs_crypt_stat crypt_stat;
413 int i;413 size_t i;
414414
415 for (i = 0;415 for (i = 0;
416 i < (sizeof(upper_lower_test_vector)416 i < (sizeof(upper_lower_test_vector)
417417
=== modified file 'tests/kernel/directory-concurrent/test.c'
--- tests/kernel/directory-concurrent/test.c 2012-02-02 15:04:32 +0000
+++ tests/kernel/directory-concurrent/test.c 2013-10-28 17:50:31 +0000
@@ -149,7 +149,7 @@
149149
150int test_dirs(const char *path, const int max_dirs)150int test_dirs(const char *path, const int max_dirs)
151{151{
152 int i, j;152 int i;
153 char *filename;153 char *filename;
154 size_t len = strlen(path) + 32;154 size_t len = strlen(path) + 32;
155 int ret = TEST_PASSED;155 int ret = TEST_PASSED;
156156
=== modified file 'tests/kernel/enospc/test.c'
--- tests/kernel/enospc/test.c 2013-10-25 22:51:40 +0000
+++ tests/kernel/enospc/test.c 2013-10-28 17:50:31 +0000
@@ -38,7 +38,6 @@
38int test_exercise(char *filename, off_t size)38int test_exercise(char *filename, off_t size)
39{39{
40 int fd;40 int fd;
41 struct stat statbuf;
42 int ret = TEST_FAILED;41 int ret = TEST_FAILED;
43 unsigned char buff[BUFF_SZ];42 unsigned char buff[BUFF_SZ];
4443
4544
=== modified file 'tests/kernel/extend-file-random/test.c'
--- tests/kernel/extend-file-random/test.c 2013-10-25 23:14:23 +0000
+++ tests/kernel/extend-file-random/test.c 2013-10-28 17:50:31 +0000
@@ -42,32 +42,46 @@
4242
43int test_write(int fd, char *buffer, size_t len, off_t offset)43int test_write(int fd, char *buffer, size_t len, off_t offset)
44{44{
45 ssize_t rc;
46
45 if (lseek(fd, offset, SEEK_SET) < 0) {47 if (lseek(fd, offset, SEEK_SET) < 0) {
46 fprintf(stderr, "Failed to seek to position %jd: %s\n", 48 fprintf(stderr, "Failed to seek to position %jd: %s\n",
47 (intmax_t)offset, strerror(errno));49 (intmax_t)offset, strerror(errno));
48 return TEST_FAILED;50 return TEST_FAILED;
49 }51 }
5052
51 if (write(fd, buffer, len) != len) {53 rc = write(fd, buffer, len);
54 if (rc < 0) {
52 fprintf(stderr, "Failed to write %zu bytes, position %jd: %s\n",55 fprintf(stderr, "Failed to write %zu bytes, position %jd: %s\n",
53 len, (intmax_t)offset, strerror(errno));56 len, (intmax_t)offset, strerror(errno));
54 return TEST_FAILED;57 return TEST_FAILED;
58 } else if (((size_t)rc) < len) {
59 fprintf(stderr, "Failed to write %zu bytes, position %jd: short write of %zd bytes\n",
60 len, (intmax_t)offset, rc);
61 return TEST_FAILED;
55 }62 }
56 return TEST_PASSED;63 return TEST_PASSED;
57}64}
5865
59int test_read(int fd, char *buffer, size_t len, off_t offset)66int test_read(int fd, char *buffer, size_t len, off_t offset)
60{67{
68 ssize_t rc;
69
61 if (lseek(fd, offset, SEEK_SET) < 0) {70 if (lseek(fd, offset, SEEK_SET) < 0) {
62 fprintf(stderr, "Failed to seek to position %jd: %s\n", 71 fprintf(stderr, "Failed to seek to position %jd: %s\n",
63 (intmax_t)offset, strerror(errno));72 (intmax_t)offset, strerror(errno));
64 return TEST_FAILED;73 return TEST_FAILED;
65 }74 }
6675
67 if (read(fd, buffer, len) != len) {76 rc = read(fd, buffer, len);
77 if (rc < 0) {
68 fprintf(stderr, "Failed to read %zu bytes, position %jd: %s\n", 78 fprintf(stderr, "Failed to read %zu bytes, position %jd: %s\n",
69 len, (intmax_t)offset, strerror(errno));79 len, (intmax_t)offset, strerror(errno));
70 return TEST_FAILED;80 return TEST_FAILED;
81 } else if (((size_t)rc) < len) {
82 fprintf(stderr, "Failed to read %zu bytes, position %jd: short read of %zd bytes\n",
83 len, (intmax_t)offset, rc);
84 return TEST_FAILED;
71 }85 }
72 return TEST_PASSED;86 return TEST_PASSED;
73}87}
7488
=== modified file 'tests/kernel/file-concurrent/test.c'
--- tests/kernel/file-concurrent/test.c 2012-03-08 17:31:44 +0000
+++ tests/kernel/file-concurrent/test.c 2013-10-28 17:50:31 +0000
@@ -177,7 +177,7 @@
177177
178int test_files(const char *path, const int max_files)178int test_files(const char *path, const int max_files)
179{179{
180 int i, j;180 int i;
181 char *filename;181 char *filename;
182 size_t len = strlen(path) + 32;182 size_t len = strlen(path) + 32;
183 int ret = TEST_PASSED;183 int ret = TEST_PASSED;
184184
=== modified file 'tests/kernel/inode-race-stat/test.c'
--- tests/kernel/inode-race-stat/test.c 2013-03-13 14:55:11 +0000
+++ tests/kernel/inode-race-stat/test.c 2013-10-28 17:50:31 +0000
@@ -107,7 +107,6 @@
107{107{
108 for (;;) {108 for (;;) {
109 int n;109 int n;
110 int ret;
111 char cmd[32];110 char cmd[32];
112111
113 if ((n = read(fdin, cmd, sizeof(cmd))) < 1) {112 if ((n = read(fdin, cmd, sizeof(cmd))) < 1) {
@@ -362,9 +361,9 @@
362 cmd[0] = CMD_QUIT;361 cmd[0] = CMD_QUIT;
363 for (i = 0; i < threads; i++) {362 for (i = 0; i < threads; i++) {
364 int status;363 int status;
365 int ret;
366364
367 ret = write(pipe_to[i][1], cmd, 1);365 if (write(pipe_to[i][1], cmd, 1) != 1)
366 continue;
368 (void)waitpid(pids[i], &status, 0);367 (void)waitpid(pids[i], &status, 0);
369368
370 (void)close(pipe_to[i][1]);369 (void)close(pipe_to[i][1]);
371370
=== modified file 'tests/kernel/inotify/test.c'
--- tests/kernel/inotify/test.c 2013-06-06 07:58:30 +0000
+++ tests/kernel/inotify/test.c 2013-10-28 17:50:31 +0000
@@ -195,7 +195,7 @@
195 * mk_filename()195 * mk_filename()
196 * simple helper to create a filename196 * simple helper to create a filename
197 */197 */
198void inline mk_filename(char *filename, size_t len, const char *path, const char *name)198inline void mk_filename(char *filename, size_t len, const char *path, const char *name)
199{199{
200 snprintf(filename, len, "%s/%s", path, name);200 snprintf(filename, len, "%s/%s", path, name);
201}201}
202202
=== modified file 'tests/kernel/lp-509180/test.c'
--- tests/kernel/lp-509180/test.c 2012-03-01 15:55:22 +0000
+++ tests/kernel/lp-509180/test.c 2013-10-28 17:50:31 +0000
@@ -48,7 +48,6 @@
48 int fd;48 int fd;
49 int opt, flags = 0;49 int opt, flags = 0;
50 int rc = 0;50 int rc = 0;
51 unsigned int *ptr;
52 char *file;51 char *file;
53 unsigned char buffer[1];52 unsigned char buffer[1];
5453
5554
=== modified file 'tests/kernel/trunc-file/test.c'
--- tests/kernel/trunc-file/test.c 2013-07-05 14:56:30 +0000
+++ tests/kernel/trunc-file/test.c 2013-10-28 17:50:31 +0000
@@ -39,7 +39,7 @@
3939
40int write_buff(int fd, unsigned char *data, ssize_t size)40int write_buff(int fd, unsigned char *data, ssize_t size)
41{41{
42 char *ptr = data;42 unsigned char *ptr = data;
43 ssize_t n;43 ssize_t n;
44 ssize_t sz = size;44 ssize_t sz = size;
4545
@@ -55,7 +55,7 @@
5555
56int read_buff(int fd, unsigned char *data, ssize_t size)56int read_buff(int fd, unsigned char *data, ssize_t size)
57{57{
58 char *ptr = data;58 unsigned char *ptr = data;
59 ssize_t n;59 ssize_t n;
60 ssize_t sz = size;60 ssize_t sz = size;
6161
@@ -159,9 +159,6 @@
159int test_exercise(char *filename, ssize_t size)159int test_exercise(char *filename, ssize_t size)
160{160{
161 int fd;161 int fd;
162 ssize_t i;
163 ssize_t n;
164 ssize_t buflen;
165 int ret = TEST_FAILED;162 int ret = TEST_FAILED;
166 ssize_t trunc_size = size / 2;163 ssize_t trunc_size = size / 2;
167 struct stat statbuf;164 struct stat statbuf;
@@ -257,8 +254,6 @@
257{254{
258 ssize_t len = DEFAULT_SIZE;255 ssize_t len = DEFAULT_SIZE;
259 const ssize_t max_len = SSIZE_MAX / 1024;256 const ssize_t max_len = SSIZE_MAX / 1024;
260 int i;
261 int ret;
262257
263 if (argc < 2) {258 if (argc < 2) {
264 fprintf(stderr, "Syntax: %s filename [size_in_K]\n", argv[0]);259 fprintf(stderr, "Syntax: %s filename [size_in_K]\n", argv[0]);
265260
=== modified file 'tests/userspace/wrap-unwrap/test.c'
--- tests/userspace/wrap-unwrap/test.c 2013-06-05 18:29:54 +0000
+++ tests/userspace/wrap-unwrap/test.c 2013-10-28 17:50:31 +0000
@@ -19,7 +19,7 @@
19 int decrypted_passphrase_size;19 int decrypted_passphrase_size;
20 char salt[ECRYPTFS_SALT_SIZE + 1];20 char salt[ECRYPTFS_SALT_SIZE + 1];
21 char *path;21 char *path;
22 int i, j;22 int i;
23 int rc = 0;23 int rc = 0;
2424
25 if (argc != 2) {25 if (argc != 2) {

Subscribers

People subscribed via source and target branches