diff options
author | Christoph Hellwig <hch@lst.de> | 2017-09-01 11:39:13 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-09-04 19:05:15 -0400 |
commit | bdd1d2d3d251c65b74ac4493e08db18971c09240 (patch) | |
tree | 71df247eeb367203c59a26eed8a384398c2d8131 /fs/exec.c | |
parent | c41fbad015dabb0a40ecca50c3ff5658eb6471ff (diff) |
fs: fix kernel_read prototype
Use proper ssize_t and size_t types for the return value and count
argument, move the offset last and make it an in/out argument like
all other read/write helpers, and make the buf argument a void pointer
to get rid of lots of casts in the callers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -922,8 +922,7 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size, | |||
922 | 922 | ||
923 | pos = 0; | 923 | pos = 0; |
924 | while (pos < i_size) { | 924 | while (pos < i_size) { |
925 | bytes = kernel_read(file, pos, (char *)(*buf) + pos, | 925 | bytes = kernel_read(file, *buf + pos, i_size - pos, &pos); |
926 | i_size - pos); | ||
927 | if (bytes < 0) { | 926 | if (bytes < 0) { |
928 | ret = bytes; | 927 | ret = bytes; |
929 | goto out; | 928 | goto out; |
@@ -931,7 +930,6 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size, | |||
931 | 930 | ||
932 | if (bytes == 0) | 931 | if (bytes == 0) |
933 | break; | 932 | break; |
934 | pos += bytes; | ||
935 | } | 933 | } |
936 | 934 | ||
937 | if (pos != i_size) { | 935 | if (pos != i_size) { |
@@ -1524,6 +1522,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm) | |||
1524 | int prepare_binprm(struct linux_binprm *bprm) | 1522 | int prepare_binprm(struct linux_binprm *bprm) |
1525 | { | 1523 | { |
1526 | int retval; | 1524 | int retval; |
1525 | loff_t pos = 0; | ||
1527 | 1526 | ||
1528 | bprm_fill_uid(bprm); | 1527 | bprm_fill_uid(bprm); |
1529 | 1528 | ||
@@ -1534,7 +1533,7 @@ int prepare_binprm(struct linux_binprm *bprm) | |||
1534 | bprm->cred_prepared = 1; | 1533 | bprm->cred_prepared = 1; |
1535 | 1534 | ||
1536 | memset(bprm->buf, 0, BINPRM_BUF_SIZE); | 1535 | memset(bprm->buf, 0, BINPRM_BUF_SIZE); |
1537 | return kernel_read(bprm->file, 0, bprm->buf, BINPRM_BUF_SIZE); | 1536 | return kernel_read(bprm->file, bprm->buf, BINPRM_BUF_SIZE, &pos); |
1538 | } | 1537 | } |
1539 | 1538 | ||
1540 | EXPORT_SYMBOL(prepare_binprm); | 1539 | EXPORT_SYMBOL(prepare_binprm); |