vfs: zero-initialize struct stat in *_stat and *_fstat handlers

...otherwise some fields will contain garbage values.
This wasn't noticed until HAVE_BLKSIZE got enabled in newlib builds.
This commit is contained in:
Ivan Grokhotkov
2020-11-05 17:38:22 +01:00
parent 7f3b16a99d
commit b1c4107275
5 changed files with 6 additions and 2 deletions

View File

@@ -207,6 +207,7 @@ static ssize_t tusb_read(int fd, void *data, size_t size)
static int tusb_fstat(int fd, struct stat *st)
{
FD_CHECK(fd, -1);
memset(st, 0, sizeof(*st));
st->st_mode = S_IFCHR;
return 0;
}