diff options
| author | Ian McFarlane <i.mcfarlane2002@gmail.com> | 2025-04-20 16:04:47 -0400 |
|---|---|---|
| committer | Ian McFarlane <i.mcfarlane2002@gmail.com> | 2025-04-20 16:04:47 -0400 |
| commit | a69d4d377666b7dd0b6cd0d5eeb58f07a971e581 (patch) | |
| tree | 02cfa436e8cfd89faf27023f81a5c1067d83e107 /kernel | |
| parent | add ata_init to main and fix some compilation problems (diff) | |
| download | comus-a69d4d377666b7dd0b6cd0d5eeb58f07a971e581.tar.gz comus-a69d4d377666b7dd0b6cd0d5eeb58f07a971e581.tar.bz2 comus-a69d4d377666b7dd0b6cd0d5eeb58f07a971e581.zip | |
oob check
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/drivers/ata.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/drivers/ata.c b/kernel/drivers/ata.c index 60ce54f..2e9fe28 100644 --- a/kernel/drivers/ata.c +++ b/kernel/drivers/ata.c @@ -163,8 +163,8 @@ static void ide_channel_write(struct ide_channel *channel, const uint8_t reg, outb(channel->io_base + reg - 0x06, data); } else if (reg < 0x0E) { outb(channel->control_base + reg - 0x0A, data); - // someone on OSdev said this was the correct thing - // https://wiki.osdev.org/Talk:PCI_IDE_Controller + // someone on OSdev said this was the correct thing + // https://wiki.osdev.org/Talk:PCI_IDE_Controller // outb(channel->control_base + reg - 0x0C, data); } else if (reg < 0x16) { outb(channel->bus_master_ide_base + reg - 0x0E, data); @@ -369,6 +369,9 @@ uint8_t ide_device_print_poll_error(struct ide_device *dev, static const char *channel_displaynames[] = { "Primary", "Secondary" }; static const char *device_displaynames[] = { "Master", "Slave" }; + if (dev->channel_idx >= 2 || dev->drive_idx >= 2) + panic("out of bounds"); + const char *channel_displayname = channel_displaynames[dev->channel_idx]; const char *device_displayname = device_displaynames[dev->drive_idx]; |