Whamcloud - gitweb
blkid: Avoid division by zero error when probing an invalid FAT filesystem
authorTheodore Ts'o <tytso@mit.edu>
Sun, 16 Dec 2007 03:21:31 +0000 (22:21 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 16 Dec 2007 03:21:31 +0000 (22:21 -0500)
Addresses-Sourceforge-Bug: #1831627

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/blkid/probe.c

index a188d82..4c72a56 100644 (file)
@@ -284,6 +284,8 @@ static int probe_fat(struct blkid_probe *probe,
                        (sector_size-1)) / sector_size;
 
        cluster_count = sect_count - (reserved + fat_size + dir_size);
+       if (ms->ms_cluster_size == 0)
+               return 1;
        cluster_count /= ms->ms_cluster_size;
 
        if (cluster_count > FAT32_MAX)