summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan McFarlane <i.mcfarlane2002@gmail.com>2025-04-20 16:04:47 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-20 23:44:39 -0400
commit449c53ea73d3bc60d199cc7c3aa68e074efd1572 (patch)
tree0373373714086f73997e2b44e5564ccbdd4336df
parentadd ata_init to main and fix some compilation problems (diff)
downloadcomus-449c53ea73d3bc60d199cc7c3aa68e074efd1572.tar.gz
comus-449c53ea73d3bc60d199cc7c3aa68e074efd1572.tar.bz2
comus-449c53ea73d3bc60d199cc7c3aa68e074efd1572.zip
oob check
-rw-r--r--kernel/drivers/ata.c7
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];