提交 a7d4b8fe 创建 作者: Austin Clements's avatar Austin Clements

argcheckptr can take a const pointer

上级 6f540f24
...@@ -201,7 +201,7 @@ void destroylock(struct spinlock *lk); ...@@ -201,7 +201,7 @@ void destroylock(struct spinlock *lk);
void release(struct spinlock*); void release(struct spinlock*);
// syscall.c // syscall.c
int argcheckptr(void *argval, int); int argcheckptr(const void *argval, int);
int argcheckstr(const char*); int argcheckstr(const char*);
int fetchint64(uptr, u64*); int fetchint64(uptr, u64*);
int fetchstr(char*, const char*, u64); int fetchstr(char*, const char*, u64);
......
...@@ -68,7 +68,7 @@ argcheckstr(const char *addr) ...@@ -68,7 +68,7 @@ argcheckstr(const char *addr)
// to a block of memory of size n bytes. Check that the pointer // to a block of memory of size n bytes. Check that the pointer
// lies within the process address space. // lies within the process address space.
int int
argcheckptr(void *p, int size) argcheckptr(const void *p, int size)
{ {
u64 i = (u64) p; u64 i = (u64) p;
for(uptr va = PGROUNDDOWN(i); va < i+size; va = va + PGSIZE) for(uptr va = PGROUNDDOWN(i); va < i+size; va = va + PGSIZE)
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论