From: robert Date: Wed, 6 Sep 2023 12:45:19 +0000 (+0000) Subject: explicitly cast ULLONG_MAX to double when comparing to a double X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b4709bb3480758ca8823c0c599f84e28dee2a220;p=openbsd explicitly cast ULLONG_MAX to double when comparing to a double ok krw@ --- diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 78857fc6840..5e29c14f503 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.416 2023/09/06 03:17:32 jsg Exp $ */ +/* $OpenBSD: editor.c,v 1.417 2023/09/06 12:45:19 robert Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller @@ -1951,7 +1951,7 @@ apply_unit(double val, u_char unit, u_int64_t *n) } val *= factor / DEV_BSIZE; - if (val > ULLONG_MAX) + if (val > (double)ULLONG_MAX) return -1; *n = val; return 0; @@ -1962,7 +1962,7 @@ parse_sizespec(const char *buf, double *val, char **unit) { errno = 0; *val = strtod(buf, unit); - if (errno == ERANGE || *val < 0 || *val > ULLONG_MAX) + if (errno == ERANGE || *val < 0 || *val > (double)ULLONG_MAX) return -1; /* too big/small */ if (*val == 0 && *unit == buf) return -1; /* No conversion performed. */