disk/scsi: fix use after free
Found by: Coverity scan. CID: 96713
This commit is contained in:
parent
c069460259
commit
cd816bd236
1 changed files with 3 additions and 2 deletions
|
@ -615,9 +615,10 @@ grub_scsi_open (const char *name, grub_disk_t disk)
|
||||||
|
|
||||||
if (scsi->blocksize & (scsi->blocksize - 1) || !scsi->blocksize)
|
if (scsi->blocksize & (scsi->blocksize - 1) || !scsi->blocksize)
|
||||||
{
|
{
|
||||||
|
grub_error (GRUB_ERR_IO, "invalid sector size %d",
|
||||||
|
scsi->blocksize);
|
||||||
grub_free (scsi);
|
grub_free (scsi);
|
||||||
return grub_error (GRUB_ERR_IO, "invalid sector size %d",
|
return grub_errno;
|
||||||
scsi->blocksize);
|
|
||||||
}
|
}
|
||||||
for (disk->log_sector_size = 0;
|
for (disk->log_sector_size = 0;
|
||||||
(1U << disk->log_sector_size) < scsi->blocksize;
|
(1U << disk->log_sector_size) < scsi->blocksize;
|
||||||
|
|
Loading…
Reference in a new issue