summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <[email protected]>2011-02-28 09:32:20 -0500
committerRuss Cox <[email protected]>2011-02-28 09:32:20 -0500
commitc5f538735191330cc112485548e6dc46317eea83 (patch)
tree92175f170c56754ed5df2d48b3bb3fae8b56d1b4
parenta6cd7509c4cb30a7d58aa2797dc979daaa795fd0 (diff)
downloadxv6-labs-c5f538735191330cc112485548e6dc46317eea83.tar.gz
xv6-labs-c5f538735191330cc112485548e6dc46317eea83.tar.bz2
xv6-labs-c5f538735191330cc112485548e6dc46317eea83.zip
fixes from Peter Froehlich
-rw-r--r--console.c12
-rw-r--r--mkfs.c2
-rw-r--r--syscall.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/console.c b/console.c
index 634e9e8..27649e6 100644
--- a/console.c
+++ b/console.c
@@ -23,24 +23,24 @@ static struct {
} cons;
static void
-printint(int xx, int base, int sgn)
+printint(int xx, int base, int sign)
{
static char digits[] = "0123456789abcdef";
char buf[16];
- int i, neg;
+ int i;
uint x;
- if(sgn && (neg = xx < 0)){
- neg = 1;
+ if(sign && (sign = xx < 0))
x = -xx;
- } else
+ else
x = xx;
i = 0;
do{
buf[i++] = digits[x % base];
}while((x /= base) != 0);
- if(neg)
+
+ if(sign)
buf[i++] = '-';
while(--i >= 0)
diff --git a/mkfs.c b/mkfs.c
index 77e6791..20b9649 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -229,7 +229,7 @@ balloc(int used)
int i;
printf("balloc: first %d blocks have been allocated\n", used);
- assert(used < 512);
+ assert(used < 512*8);
bzero(buf, 512);
for(i = 0; i < used; i++){
buf[i/8] = buf[i/8] | (0x1 << (i%8));
diff --git a/syscall.c b/syscall.c
index 16c5b47..f6550a1 100644
--- a/syscall.c
+++ b/syscall.c
@@ -57,7 +57,7 @@ argptr(int n, char **pp, int size)
if(argint(n, &i) < 0)
return -1;
- if((uint)i >= proc->sz || (uint)i+size >= proc->sz)
+ if((uint)i >= proc->sz || (uint)i+size > proc->sz)
return -1;
*pp = (char*)i;
return 0;