summaryrefslogtreecommitdiffstats
path: root/src/fat.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-04-09 12:42:21 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-04-09 12:42:21 +0200
commitb798f3ca98abe66b29727c979d07f6c0bbd1894c (patch)
treee56d14eb9ab1a5486401ec4887dba60b2d72649c /src/fat.c
parent07b95092e25550f03c3f7f8acb922de4cbb19372 (diff)
fat32_set_part_name(): define a const variable to hold the cluster size (style)
Diffstat (limited to 'src/fat.c')
-rw-r--r--src/fat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fat.c b/src/fat.c
index d5ac5dd..cde16f6 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -831,10 +831,10 @@ static int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const s
partition->fsname[0]='\0';
if((fat_header->sectors_per_cluster>0)&&(fat_header->sectors_per_cluster<=128))
{
- unsigned char *buffer=(unsigned char*)MALLOC(fat_header->sectors_per_cluster*disk_car->sector_size);
- if((unsigned)disk_car->pread(disk_car, buffer,
- fat_header->sectors_per_cluster * disk_car->sector_size,
- partition->part_offset + (le16(fat_header->reserved) + fat_header->fats * le32(fat_header->fat32_length) + (uint64_t)(le32(fat_header->root_cluster) - 2) * fat_header->sectors_per_cluster) * disk_car->sector_size) != fat_header->sectors_per_cluster * disk_car->sector_size)
+ const unsigned int cluster_size=fat_header->sectors_per_cluster*disk_car->sector_size;
+ unsigned char *buffer=(unsigned char*)MALLOC(cluster_size);
+ if((unsigned)disk_car->pread(disk_car, buffer, cluster_size,
+ partition->part_offset + (le16(fat_header->reserved) + fat_header->fats * le32(fat_header->fat32_length) + (uint64_t)(le32(fat_header->root_cluster) - 2) * fat_header->sectors_per_cluster) * disk_car->sector_size) != cluster_size)
{
log_error("fat32_set_part_name() cannot read FAT32 root cluster.\n");
}