From 318359de1550140e15abf39d751904f3f9cb79b3 Mon Sep 17 00:00:00 2001 From: CCXXXI Date: Mon, 11 Jan 2021 03:26:44 +0800 Subject: [PATCH] add const --- src/userprog/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index 5c33b71..7a67c78 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -150,7 +150,7 @@ static bool is_valid_ptr(const void *ptr) /* Returns true if [START, START + SIZE) is all valid. */ static bool is_user_mem(const void *start, size_t size) { - for (void *ptr = start; ptr < start + size; ptr += PGSIZE) + for (const void *ptr = start; ptr < start + size; ptr += PGSIZE) { if (!is_valid_ptr(ptr)) return false; @@ -168,7 +168,7 @@ static bool is_valid_str(const char *str) if (!is_valid_ptr(str)) return false; - for (char *c = str; *c != '\0';) + for (const char *c = str; *c != '\0';) { ++c; if (c - str + 2 == PGSIZE || !is_valid_ptr(c))