mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 10:14:55 +00:00
Sanity-check output of VbExDiskGetInfo()
BUG=chromium-os:22724 TEST=none Source change only, nothing for QA to test. Change-Id: I058137c04622b5aedae4a94ce6e3887325c16974 Reviewed-on: https://gerrit.chromium.org/gerrit/11546 Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
This commit is contained in:
@@ -69,6 +69,15 @@ uint32_t VbTryLoadKernel(VbCommonParams* cparams, LoadKernelParams* p,
|
||||
/* Loop over disks */
|
||||
for (i = 0; i < disk_count; i++) {
|
||||
VBDEBUG(("VbTryLoadKernel() trying disk %d\n", (int)i));
|
||||
/* Sanity-check what we can. FWIW, VbTryLoadKernel() is always called
|
||||
* with only a single bit set in get_info_flags
|
||||
*/
|
||||
if (512 != disk_info[i].bytes_per_lba || /* cgptlib restriction */
|
||||
32 > disk_info[i].lba_count || /* ditto */
|
||||
get_info_flags != disk_info[i].flags) { /* got only what we asked for */
|
||||
VBDEBUG((" skipping - bogus parameters\n"));
|
||||
continue;
|
||||
}
|
||||
p->disk_handle = disk_info[i].handle;
|
||||
p->bytes_per_lba = disk_info[i].bytes_per_lba;
|
||||
p->ending_lba = disk_info[i].lba_count - 1;
|
||||
|
||||
Reference in New Issue
Block a user