* [patch 2/8] netfilter: xt_time gives a wrong monthday in a leap year
@ 2008-09-22 21:50 akpm
2008-09-23 2:03 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2008-09-22 21:50 UTC (permalink / raw)
To: davem; +Cc: netdev, akpm, kaih.luo, jengelh, kaber
From: Kaihui Luo <kaih.luo@gmail.com>
The function localtime_3 in xt_time.c gives a wrong monthday in a leap
year after 28th 2. calculating monthday should use the array
days_since_leapyear[] not days_since_year[] in a leap year.
Signed-off-by: Kaihui Luo <kaih.luo@gmail.com>
Acked-by: Jan Engelhardt <jengelh@computergmbh.de>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
net/netfilter/xt_time.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff -puN net/netfilter/xt_time.c~netfilter-xt_time-gives-a-wrong-monthday-in-a-leap-year net/netfilter/xt_time.c
--- a/net/netfilter/xt_time.c~netfilter-xt_time-gives-a-wrong-monthday-in-a-leap-year
+++ a/net/netfilter/xt_time.c
@@ -136,17 +136,19 @@ static void localtime_3(struct xtm *r, t
* from w repeatedly while counting.)
*/
if (is_leap(year)) {
+ /* use days_since_leapyear[] in a leap year */
for (i = ARRAY_SIZE(days_since_leapyear) - 1;
- i > 0 && days_since_year[i] > w; --i)
+ i > 0 && days_since_leapyear[i] > w; --i)
/* just loop */;
+ r->monthday = w - days_since_leapyear[i] + 1;
} else {
for (i = ARRAY_SIZE(days_since_year) - 1;
i > 0 && days_since_year[i] > w; --i)
/* just loop */;
+ r->monthday = w - days_since_year[i] + 1;
}
r->month = i + 1;
- r->monthday = w - days_since_year[i] + 1;
return;
}
_
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch 2/8] netfilter: xt_time gives a wrong monthday in a leap year
2008-09-22 21:50 [patch 2/8] netfilter: xt_time gives a wrong monthday in a leap year akpm
@ 2008-09-23 2:03 ` David Miller
2008-09-24 9:29 ` Patrick McHardy
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2008-09-23 2:03 UTC (permalink / raw)
To: akpm; +Cc: netdev, kaih.luo, jengelh, kaber
From: akpm@linux-foundation.org
Date: Mon, 22 Sep 2008 14:50:36 -0700
> From: Kaihui Luo <kaih.luo@gmail.com>
>
> The function localtime_3 in xt_time.c gives a wrong monthday in a leap
> year after 28th 2. calculating monthday should use the array
> days_since_leapyear[] not days_since_year[] in a leap year.
>
> Signed-off-by: Kaihui Luo <kaih.luo@gmail.com>
> Acked-by: Jan Engelhardt <jengelh@computergmbh.de>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Patrick, this seems pretty straightforward so I applied it
to net-next-2.6
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 2/8] netfilter: xt_time gives a wrong monthday in a leap year
2008-09-23 2:03 ` David Miller
@ 2008-09-24 9:29 ` Patrick McHardy
0 siblings, 0 replies; 3+ messages in thread
From: Patrick McHardy @ 2008-09-24 9:29 UTC (permalink / raw)
To: David Miller; +Cc: akpm, netdev, kaih.luo, jengelh
David Miller wrote:
> From: akpm@linux-foundation.org
> Date: Mon, 22 Sep 2008 14:50:36 -0700
>
>> From: Kaihui Luo <kaih.luo@gmail.com>
>>
>> The function localtime_3 in xt_time.c gives a wrong monthday in a leap
>> year after 28th 2. calculating monthday should use the array
>> days_since_leapyear[] not days_since_year[] in a leap year.
>>
>> Signed-off-by: Kaihui Luo <kaih.luo@gmail.com>
>> Acked-by: Jan Engelhardt <jengelh@computergmbh.de>
>> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>
> Patrick, this seems pretty straightforward so I applied it
> to net-next-2.6
Thanks Dave.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-24 9:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-22 21:50 [patch 2/8] netfilter: xt_time gives a wrong monthday in a leap year akpm
2008-09-23 2:03 ` David Miller
2008-09-24 9:29 ` Patrick McHardy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).