aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 8adcc5eaa175..15fb4d56cc43 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -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)
1524int prepare_binprm(struct linux_binprm *bprm) 1522int 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
1540EXPORT_SYMBOL(prepare_binprm); 1539EXPORT_SYMBOL(prepare_binprm);