diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2010-04-20 16:10:28 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2010-04-20 16:10:28 +0000 |
commit | 9e663e93a646c61c6c68ed8f8582573429e8c48e (patch) | |
tree | d596d18b0bca54fe5288bfd827f40d3823f03f19 | |
parent | 760587ff8d136daba6647dab81261c3c73d35296 (diff) |
0x0 is a valid base address.
ok oga
-rw-r--r-- | usr.sbin/memconfig/memconfig.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/memconfig/memconfig.c b/usr.sbin/memconfig/memconfig.c index 12b6ebdea3e..f684b6d9e7f 100644 --- a/usr.sbin/memconfig/memconfig.c +++ b/usr.sbin/memconfig/memconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memconfig.c,v 1.12 2007/09/02 15:19:39 deraadt Exp $ */ +/* $OpenBSD: memconfig.c,v 1.13 2010/04/20 16:10:27 marco Exp $ */ /*- * Copyright (c) 1999 Michael Smith <msmith@freebsd.org> @@ -254,7 +254,7 @@ clearfunc(int memfd, int argc, char *argv[]) { struct mem_range_desc mrd, *mrdp; struct mem_range_op mro; - int i, nd, ch; + int i, nd, ch, got_base = 0; char *ep, *owner; mrd.mr_base = 0; @@ -266,6 +266,8 @@ clearfunc(int memfd, int argc, char *argv[]) mrd.mr_base = strtouq(optarg, &ep, 0); if ((ep == optarg) || (*ep != 0)) help("clear"); + else + got_base = 1; break; case 'l': mrd.mr_len = strtouq(optarg, &ep, 0); @@ -285,7 +287,7 @@ clearfunc(int memfd, int argc, char *argv[]) if (owner != NULL) { /* clear-by-owner */ - if ((mrd.mr_base != 0) || (mrd.mr_len != 0)) + if (got_base || mrd.mr_len != 0) help("clear"); mrdp = mrgetall(memfd, &nd); @@ -301,7 +303,7 @@ clearfunc(int memfd, int argc, char *argv[]) owner); } } - } else if ((mrd.mr_base != 0) && (mrd.mr_len != 0)) { + } else if (got_base && mrd.mr_len != 0) { /* clear-by-base/len */ mro.mo_arg[0] = MEMRANGE_SET_REMOVE; mro.mo_desc = &mrd; |