{"id":953,"url":"http://patchwork.ozlabs.org/api/1.0/patches/953/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<200809222150.m8MLoaXW031860@imap1.linux-foundation.org>","date":"2008-09-22T21:50:36","name":"[2/8] netfilter: xt_time gives a wrong monthday in a leap year","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"f23e9242f7977ce4d730bede7e172e034b293384","submitter":{"id":107,"url":"http://patchwork.ozlabs.org/api/1.0/people/107/?format=json","name":"Andrew Morton","email":"akpm@linux-foundation.org"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.0/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/200809222150.m8MLoaXW031860@imap1.linux-foundation.org/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/953/checks/","tags":{},"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Received":["from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 22752DDF4C\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 23 Sep 2008 07:51:28 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753472AbYIVVvV (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 17:51:21 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1753379AbYIVVvV\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 17:51:21 -0400","from smtp1.linux-foundation.org ([140.211.169.13]:54831 \"EHLO\n\tsmtp1.linux-foundation.org\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1753448AbYIVVvV (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 22 Sep 2008 17:51:21 -0400","from imap1.linux-foundation.org (imap1.linux-foundation.org\n\t[140.211.169.55])\n\tby smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with\n\tESMTP id m8MLobvn018143\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\n\tMon, 22 Sep 2008 14:50:38 -0700","from localhost.localdomain (localhost [127.0.0.1])\n\tby imap1.linux-foundation.org\n\t(8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id\n\tm8MLoaXW031860; Mon, 22 Sep 2008 14:50:36 -0700"],"Message-Id":"<200809222150.m8MLoaXW031860@imap1.linux-foundation.org>","Subject":"[patch 2/8] netfilter: xt_time gives a wrong monthday in a leap year","To":"davem@davemloft.net","Cc":"netdev@vger.kernel.org, akpm@linux-foundation.org,\n\tkaih.luo@gmail.com, jengelh@computergmbh.de, kaber@trash.net","From":"akpm@linux-foundation.org","Date":"Mon, 22 Sep 2008 14:50:36 -0700","X-Spam-Status":"No, hits=-3.359 required=5 tests=AWL, BAYES_00,\n\tOSDL_HEADER_SUBJECT_BRACKETED","X-Spam-Checker-Version":"SpamAssassin 3.2.4-osdl_revision__1.47__","X-MIMEDefang-Filter":"lf$Revision: 1.188 $","X-Scanned-By":"MIMEDefang 2.63 on 140.211.169.13","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: Kaihui Luo <kaih.luo@gmail.com>\n\nThe function localtime_3 in xt_time.c gives a wrong monthday in a leap\nyear after 28th 2.  calculating monthday should use the array\ndays_since_leapyear[] not days_since_year[] in a leap year.\n\nSigned-off-by: Kaihui Luo <kaih.luo@gmail.com>\nAcked-by: Jan Engelhardt <jengelh@computergmbh.de>\nCc: Patrick McHardy <kaber@trash.net>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\n---\n\n net/netfilter/xt_time.c |    6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)","diff":"diff -puN net/netfilter/xt_time.c~netfilter-xt_time-gives-a-wrong-monthday-in-a-leap-year net/netfilter/xt_time.c\n--- a/net/netfilter/xt_time.c~netfilter-xt_time-gives-a-wrong-monthday-in-a-leap-year\n+++ a/net/netfilter/xt_time.c\n@@ -136,17 +136,19 @@ static void localtime_3(struct xtm *r, t\n \t * from w repeatedly while counting.)\n \t */\n \tif (is_leap(year)) {\n+\t\t/* use days_since_leapyear[] in a leap year */\n \t\tfor (i = ARRAY_SIZE(days_since_leapyear) - 1;\n-\t\t    i > 0 && days_since_year[i] > w; --i)\n+\t\t    i > 0 && days_since_leapyear[i] > w; --i)\n \t\t\t/* just loop */;\n+\t\tr->monthday = w - days_since_leapyear[i] + 1;\n \t} else {\n \t\tfor (i = ARRAY_SIZE(days_since_year) - 1;\n \t\t    i > 0 && days_since_year[i] > w; --i)\n \t\t\t/* just loop */;\n+\t\tr->monthday = w - days_since_year[i] + 1;\n \t}\n \n \tr->month    = i + 1;\n-\tr->monthday = w - days_since_year[i] + 1;\n \treturn;\n }\n \n","prefixes":["2/8"]}