drivers/rtc/rtc-efi.c: check for invalid data coming back from UEFI
drivers/rtc/rtc-efi.c: check for invalid data coming back from UEFI

In particular seeing zero in eft->month is problematic, as it results in
-1 (converted to unsigned int, i.e.  yielding 0xffffffff) getting passed
to rtc_year_days(), where the value gets used as an array index
(normally resulting in a crash).  This was observed with the driver
enabled on x86 on some Fujitsu system (with possibly not up to date
firmware, but anyway).

Perhaps efi_read_alarm() should not fail if neither enabled nor pending
are set, but the returned time is invalid?

Signed-off-by: Jan Beulich <01de09643e0ae62e116f8bd77de435799874b456@suse.com>
Reported-by: Raymund Will <35d495b41aa40f510ffcbb60365085b8b25447b5@suse.de>
Cc: Alessandro Zummo <f0b9bd96bf07bfecc189c62159960134588fafe5@towertech.it>
Cc: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Acked-by: Lee, Chun-Yi <1349fcb6a51505700420a1a045f800785baed24b@suse.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs