[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/17] ide: Reject invalid CHS geometry
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 16/17] ide: Reject invalid CHS geometry |
Date: |
Tue, 6 Jul 2010 17:33:25 +0200 |
From: Markus Armbruster <address@hidden>
drive_init() doesn't permit invalid CHS for if=ide, but that's
worthless: we get it via if=none and -device.
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/ide/core.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 3b84bea..af52c2c 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2604,6 +2604,18 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs,
s->bs = bs;
bdrv_get_geometry(bs, &nb_sectors);
bdrv_guess_geometry(bs, &cylinders, &heads, &secs);
+ if (cylinders < 1 || cylinders > 16383) {
+ error_report("cyls must be between 1 and 16383");
+ return -1;
+ }
+ if (heads < 1 || heads > 16) {
+ error_report("heads must be between 1 and 16");
+ return -1;
+ }
+ if (secs < 1 || secs > 63) {
+ error_report("secs must be between 1 and 63");
+ return -1;
+ }
s->cylinders = cylinders;
s->heads = heads;
s->sectors = secs;
--
1.6.6.1
- [Qemu-devel] [PATCH 06/17] raw-posix: Fix test for host CD-ROM, (continued)
- [Qemu-devel] [PATCH 06/17] raw-posix: Fix test for host CD-ROM, Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 07/17] fdc: Reject unimplemented error actions, Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 09/17] scsi: Reject unimplemented error actions, Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 08/17] qdev: Don't hw_error() in qdev_init_nofail(), Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 10/17] error: New qemu_opts_loc_restore(), Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 12/17] ide: Improve error messages, Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 11/17] scsi: Error locations for -drive if=scsi device initialization, Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 13/17] ide: Replace IDEState members is_cdrom, is_cf by drive_kind, Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 14/17] ide: Make ide_init_drive() return success, Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 15/17] ide: Reject readonly drives unless CD-ROM, Kevin Wolf, 2010/07/06
- [Qemu-devel] [PATCH 16/17] ide: Reject invalid CHS geometry,
Kevin Wolf <=
- [Qemu-devel] [PATCH 17/17] block: add sheepdog driver for distributed storage support, Kevin Wolf, 2010/07/06
- Re: [Qemu-devel] [PULL 00/17] Block patches, Anthony Liguori, 2010/07/06