diff options
author | David Howells <dhowells@redhat.com> | 2016-02-24 14:37:15 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-12 07:33:26 -0700 |
commit | 15a75eb1ef158485b00efc47e2e3b5eacf531ef4 (patch) | |
tree | 201dda3aecc72267579021040b76700e0dd7d845 /ipc | |
parent | f15a9c184954e4733ec8d790bc10ab97610f1b98 (diff) | |
download | linux-stable-15a75eb1ef158485b00efc47e2e3b5eacf531ef4.tar.gz linux-stable-15a75eb1ef158485b00efc47e2e3b5eacf531ef4.tar.bz2 linux-stable-15a75eb1ef158485b00efc47e2e3b5eacf531ef4.zip |
X.509: Fix leap year handling again
commit ac4cbedfdf55455b4c447f17f0fa027dbf02b2a6 upstream.
There are still a couple of minor issues in the X.509 leap year handling:
(1) To avoid doing a modulus-by-400 in addition to a modulus-by-100 when
determining whether the year is a leap year or not, I divided the year
by 100 after doing the modulus-by-100, thereby letting the compiler do
one instruction for both, and then did a modulus-by-4.
Unfortunately, I then passed the now-modified year value to mktime64()
to construct a time value.
Since this isn't a fast path and since mktime64() does a bunch of
divisions, just condense down to "% 400". It's also easier to read.
(2) The default month length for any February where the year doesn't
divide by four exactly is obtained from the month_length[] array where
the value is 29, not 28.
This is fixed by altering the table.
Reported-by: Rudolf Polzer <rpolzer@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions