Messages in this thread | | | From | Anatoly Trosinenko <> | Date | Sat, 14 Jul 2018 15:24:17 +0300 | Subject | FAT: Operating on broken FAT FS causes the write syscall to return negative number not equal to -1 |
| |
How to reproduce: 1) Compile v4.18-rc4 kernel with the attached config 1) Unpack the attached FS image (128 Mb) and mount it as vfat to /mnt 2) Compile and run vfat-bug.c
What is expected: `write` returns either -1 or small positive number.
What happens: The -13619152 aka 0xffffffffff303030 is returned.
Best regards, Anatoly [unhandled content-type:application/octet-stream][unhandled content-type:application/octet-stream]#define _GNU_SOURCE #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h>
char buf[123];
int main() { int fd = open("/mnt/abc", O_WRONLY, 0123); for (int i = 0; i < sizeof(buf); ++i) buf[i] = i + 1; ssize_t res = write(fd, buf, sizeof(buf)); fprintf(stderr, "res = %ld %lx\n", res, res); return 0; }
| |