[Skiboot] [PATCH 09/13] mktime: fix off-by-one error calling days_in_month

Stewart Smith stewart at linux.vnet.ibm.com
Wed Aug 23 17:21:19 AEST 2017


>From auditing all the mktime() users, there seems to be only a *very*
small window around new years day where we could possibly return
incorrect data to the OS, and even then, there would have to be FSP
reset/reload on FSP machines. I don't *think* there's an opportunity
on other machines.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 libc/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/time.c b/libc/time.c
index 6a5108691af1..71bbdff647f3 100644
--- a/libc/time.c
+++ b/libc/time.c
@@ -121,7 +121,7 @@ time_t mktime(struct tm *tm)
 	for (d = days_in_month(month, year); mday > d;
 			d = days_in_month(month, year)) {
 		month++;
-		if (month > 12) {
+		if (month > 11) {
 			month = 0;
 			year++;
 		}
-- 
2.13.5



More information about the Skiboot mailing list