grub_dmraid_nv_detect: Do not divide by zero.

This commit is contained in:
Vladimir Serbinenko 2015-01-20 15:01:58 +01:00
parent 98f74998d5
commit 935863518f
2 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Do not
divide by zero.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem

View File

@ -129,6 +129,9 @@ grub_dmraid_nv_detect (grub_disk_t disk,
case NV_LEVEL_0:
level = 0;
disk_size = sb.capacity / sb.array.total_volumes;
if (sb.array.total_volumes == 0)
/* Not RAID. */
return NULL;
break;
case NV_LEVEL_1:
@ -139,6 +142,9 @@ grub_dmraid_nv_detect (grub_disk_t disk,
case NV_LEVEL_5:
level = 5;
disk_size = sb.capacity / (sb.array.total_volumes - 1);
if (sb.array.total_volumes == 0 || sb.array.total_volumes == 1)
/* Not RAID. */
return NULL;
break;
default: