summaryrefslogtreecommitdiff
path: root/usr/src/cmd/boot/installgrub/installgrub.c
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2016-01-26 01:56:54 +0200
committerRobert Mustacchi <rm@joyent.com>2016-01-26 14:36:59 -0800
commitcc641e8dc4d38800076a2260f4d959bf86003257 (patch)
tree94534ca562094708125cbaff522d5a9addc5b62a /usr/src/cmd/boot/installgrub/installgrub.c
parenta38ee58261c5aa81028a4329e73da4016006aa99 (diff)
downloadillumos-joyent-cc641e8dc4d38800076a2260f4d959bf86003257.tar.gz
6579 installgrub efi_alloc_and_read() return value check is faulty
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/cmd/boot/installgrub/installgrub.c')
-rw-r--r--usr/src/cmd/boot/installgrub/installgrub.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr/src/cmd/boot/installgrub/installgrub.c b/usr/src/cmd/boot/installgrub/installgrub.c
index 0ae6749bcc..b01bcbd922 100644
--- a/usr/src/cmd/boot/installgrub/installgrub.c
+++ b/usr/src/cmd/boot/installgrub/installgrub.c
@@ -22,6 +22,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2016 Toomas Soome <tsoome@me.com>
*/
#include <stdio.h>
@@ -670,7 +671,7 @@ init_device(ig_device_t *device, char *path)
return (BC_ERROR);
}
- if (efi_alloc_and_read(device->disk_fd, &vtoc) > 0) {
+ if (efi_alloc_and_read(device->disk_fd, &vtoc) >= 0) {
device->type = IG_DEV_EFI;
efi_free(vtoc);
}
@@ -737,7 +738,7 @@ get_start_sector(ig_device_t *device)
if (is_efi(device->type)) {
struct dk_gpt *vtoc;
- if (efi_alloc_and_read(device->disk_fd, &vtoc) <= 0)
+ if (efi_alloc_and_read(device->disk_fd, &vtoc) < 0)
return (BC_ERROR);
device->start_sector = vtoc->efi_parts[device->slice].p_start;