[lkml]   [2018]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectFAT: 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,
[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;

 \ /
  Last update: 2018-07-15 22:07    [W:0.087 / U:1.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site