|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xen/vsprintf: Avoid returning NULL from number()
commit ce34d6b036ed84b12da6cd90a40a1302df4f1fef
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Apr 21 14:47:12 2016 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Jun 9 14:30:33 2016 +0100
xen/vsprintf: Avoid returning NULL from number()
In practice this is an unused codepath, as every caller of number() passes
an
explicit base of 8, 10 or 16. For all other uses, number() returns a
pointer
between the str and end parameters, as do the other similar helper
functions.
However, the fact that there is a NULL return path causes Coverity to check
whether the caller makes NULL checks on the return value, and complain.
Change the conditional return into an ASSERT().
No functional change, but this removes 21 instances of NULL_RETURN in
Coverity.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
---
xen/common/vsprintf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c
index b050ea3..f92fb67 100644
--- a/xen/common/vsprintf.c
+++ b/xen/common/vsprintf.c
@@ -153,11 +153,11 @@ static char *number(
static const char large_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i;
+ ASSERT(base >= 2 && base <= 36);
+
digits = (type & LARGE) ? large_digits : small_digits;
if (type & LEFT)
type &= ~ZEROPAD;
- if (base < 2 || base > 36)
- return NULL;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |