mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-27 06:30:56 +07:00
[PATCH] uml: fix off-by-one bug in VM file creation
Fix an off-by-one bug in temp file creation. Seeking to the desired length and writing a byte resulted in the file being one byte longer than expected. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
c2b7a4bb30
commit
190f493922
@ -210,8 +210,11 @@ int create_tmp_file(unsigned long long len)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lseek64(fd, len, SEEK_SET) < 0) {
|
/* Seek to len - 1 because writing a character there will
|
||||||
perror("os_seek_file");
|
* increase the file size by one byte, to the desired length.
|
||||||
|
*/
|
||||||
|
if (lseek64(fd, len - 1, SEEK_SET) < 0) {
|
||||||
|
perror("os_seek_file");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user