Date: Tue, 1 Sep 2020 15:14:26 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365044 - head/usr.sbin/pw Message-ID: <202009011514.081FEQHX093492@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Tue Sep 1 15:14:26 2020 New Revision: 365044 URL: https://svnweb.freebsd.org/changeset/base/365044 Log: pw: Remove unnecessary errp checks. The caller-supplied pointer is unconditionally dereferenced at the beginning of the function, so there is no point in comparing it with NULL thereafter. Reported by: Coverity MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Modified: head/usr.sbin/pw/strtounum.c Modified: head/usr.sbin/pw/strtounum.c ============================================================================== --- head/usr.sbin/pw/strtounum.c Tue Sep 1 15:14:13 2020 (r365043) +++ head/usr.sbin/pw/strtounum.c Tue Sep 1 15:14:26 2020 (r365044) @@ -44,28 +44,24 @@ strtounum(const char * __restrict np, uintmax_t minval *errpp = NULL; if (minval > maxval) { errno = EINVAL; - if (errpp != NULL) - *errpp = "invalid"; + *errpp = "invalid"; return (0); } errno = 0; ret = strtoumax(np, &endp, 10); if (endp == np || *endp != '\0') { errno = EINVAL; - if (errpp != NULL) - *errpp = "invalid"; + *errpp = "invalid"; return (0); } if (ret < minval) { errno = ERANGE; - if (errpp != NULL) - *errpp = "too small"; + *errpp = "too small"; return (0); } if (errno == ERANGE || ret > maxval) { errno = ERANGE; - if (errpp != NULL) - *errpp = "too large"; + *errpp = "too large"; return (0); } return (ret);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009011514.081FEQHX093492>