aboutsummaryrefslogtreecommitdiff
path: root/util-linux/volume_id/fat.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/volume_id/fat.c')
-rw-r--r--util-linux/volume_id/fat.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/util-linux/volume_id/fat.c b/util-linux/volume_id/fat.c
index 6173ba9f0..b0f427c74 100644
--- a/util-linux/volume_id/fat.c
+++ b/util-linux/volume_id/fat.c
@@ -173,18 +173,22 @@ int FAST_FUNC volume_id_probe_vfat(struct volume_id *id /*,uint64_t fat_partitio
173 */ 173 */
174 174
175 /* boot jump address check */ 175 /* boot jump address check */
176 if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && 176 if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90)
177 vs->boot_jump[0] != 0xe9) 177 && vs->boot_jump[0] != 0xe9
178 ) {
178 return -1; 179 return -1;
180 }
179 181
180 /* heads check */ 182 /* heads check */
181 if (vs->heads == 0) 183 if (vs->heads == 0)
182 return -1; 184 return -1;
183 185
184 /* cluster size check */ 186 /* cluster size check */
185 if (vs->sectors_per_cluster == 0 || 187 if (vs->sectors_per_cluster == 0
186 (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) 188 || (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))
189 ) {
187 return -1; 190 return -1;
191 }
188 192
189 /* media check */ 193 /* media check */
190 if (vs->media < 0xf8 && vs->media != 0xf0) 194 if (vs->media < 0xf8 && vs->media != 0xf0)
@@ -197,9 +201,11 @@ int FAST_FUNC volume_id_probe_vfat(struct volume_id *id /*,uint64_t fat_partitio
197 valid: 201 valid:
198 /* sector size check */ 202 /* sector size check */
199 sector_size_bytes = le16_to_cpu(vs->sector_size_bytes); 203 sector_size_bytes = le16_to_cpu(vs->sector_size_bytes);
200 if (sector_size_bytes != 0x200 && sector_size_bytes != 0x400 && 204 if (sector_size_bytes != 0x200 && sector_size_bytes != 0x400
201 sector_size_bytes != 0x800 && sector_size_bytes != 0x1000) 205 && sector_size_bytes != 0x800 && sector_size_bytes != 0x1000
206 ) {
202 return -1; 207 return -1;
208 }
203 209
204 dbg("sector_size_bytes 0x%x", sector_size_bytes); 210 dbg("sector_size_bytes 0x%x", sector_size_bytes);
205 dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); 211 dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster);