summaryrefslogtreecommitdiff
path: root/ide.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2015-04-10 07:15:06 -0400
committerFrans Kaashoek <[email protected]>2015-04-10 07:15:06 -0400
commit895af77fe6ff7c73f198e852a40976ed102a49e4 (patch)
treec951d87e397c48268fd9daf0925e2907a803a177 /ide.c
parentc24ac5d76353d04955cc348f1cb5b95743c42b38 (diff)
downloadxv6-labs-895af77fe6ff7c73f198e852a40976ed102a49e4.tar.gz
xv6-labs-895af77fe6ff7c73f198e852a40976ed102a49e4.tar.bz2
xv6-labs-895af77fe6ff7c73f198e852a40976ed102a49e4.zip
check blockno passed to idestart
Diffstat (limited to 'ide.c')
-rw-r--r--ide.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ide.c b/ide.c
index 96216ea..ed5a572 100644
--- a/ide.c
+++ b/ide.c
@@ -48,7 +48,7 @@ void
ideinit(void)
{
int i;
-
+
initlock(&idelock, "ide");
picenable(IRQ_IDE);
ioapicenable(IRQ_IDE, ncpu - 1);
@@ -73,6 +73,8 @@ idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
+ if(b->blockno >= FSSIZE)
+ panic("incorrect blockno");
int sector_per_block = BSIZE/SECTOR_SIZE;
int sector = b->blockno * sector_per_block;