]> git.proxmox.com Git - grub2.git/commitdiff
biosdisk: Add missing cast.
authorVladimir Serbinenko <phcoder@gmail.com>
Sat, 24 Jan 2015 20:50:30 +0000 (21:50 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Sat, 24 Jan 2015 20:50:30 +0000 (21:50 +0100)
Found by: Coverity scan.

grub-core/disk/i386/pc/biosdisk.c

index 26a4973ad473aacd3d5930e5a814148f8ad4259d..f0aadd111f1afa34407d3e83baf761a19d546451 100644 (file)
@@ -382,7 +382,8 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
                 /* Some buggy BIOSes doesn't return the total sectors
                    correctly but returns zero. So if it is zero, compute
                    it by C/H/S returned by the LBA BIOS call.  */
-                total_sectors = drp->cylinders * drp->heads * drp->sectors;
+                total_sectors = ((grub_uint64_t) drp->cylinders)
+                 * drp->heads * drp->sectors;
              if (drp->bytes_per_sector
                  && !(drp->bytes_per_sector & (drp->bytes_per_sector - 1))
                  && drp->bytes_per_sector >= 512
@@ -425,7 +426,8 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
        data->heads = 255;
 
       if (! total_sectors)
-        total_sectors = data->cylinders * data->heads * data->sectors;
+        total_sectors = ((grub_uint64_t) data->cylinders)
+         * data->heads * data->sectors;
     }
 
   disk->total_sectors = total_sectors;