Fix to the x86_64 "--machdep phys_base=<value>" command line option

to allow the use of a negative decimal number as the value.  Without
the patch, only the hexadecimal representation of the value would be
accepted.
(v-santy@microsoft.com, anderson@redhat.com)
This commit is contained in:
Dave Anderson 2019-06-28 14:03:35 -04:00
parent 9bee8ecbbe
commit fee99ccfd2

View File

@ -5999,13 +5999,12 @@ parse_cmdline_args(void)
}
p = arglist[i] + strlen("phys_base=");
if (strlen(p)) {
if (megabytes) {
value = dtol(p, RETURN_ON_ERROR|QUIET,
&errflag);
} else
value = htol(p, RETURN_ON_ERROR|QUIET,
&errflag);
if (!errflag) {
if (hexadecimal(p, 0) && !decimal(p, 0) &&
!STRNEQ(p, "0x") && !STRNEQ(p, "0X"))
string_insert("0x", p);
errno = 0;
value = strtoull(p, NULL, 0);
if (!errno) {
if (megabytes)
value = MEGABYTES(value);
machdep->machspec->phys_base = value;