Check if lstat size more that zero

pull/45/head
Konstantin Germanov 2022-07-12 08:57:41 -04:00
parent 48443a6fbd
commit a302a19cd2
1 changed files with 1 additions and 1 deletions

View File

@ -601,7 +601,7 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size)
* We couldn't figure it out by using a specialized ioctl,
* so do lstat on device.
*/
if (dev->d_ops->stat(dev, &sbuf) == 0 && S_ISREG(sbuf.st_mode)) {
if (dev->d_ops->stat(dev, &sbuf) == 0 && S_ISREG(sbuf.st_mode) && sbuf.st_size > 512) {
ntfs_log_debug("STAT nr bytes = %llu (0x%llx)\n",
(unsigned long long)sbuf.st_size,
(unsigned long long)sbuf.st_size);