From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755799AbbI3OP3 (ORCPT ); Wed, 30 Sep 2015 10:15:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52936 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752494AbbI3OPZ (ORCPT ); Wed, 30 Sep 2015 10:15:25 -0400 Date: Wed, 30 Sep 2015 11:15:20 -0300 From: Marcelo Ricardo Leitner To: Neil Horman Cc: Arnd Bergmann , netdev@vger.kernel.org, y2038@lists.linaro.org, linux-kernel@vger.kernel.org, "David S. Miller" , Vlad Yasevich , linux-sctp@vger.kernel.org Subject: Re: [PATCH 10/12] net: sctp: avoid incorrect time_t use Message-ID: <20150930141520.GA4893@localhost.localdomain> References: <1443612402-3000775-1-git-send-email-arnd@arndb.de> <1443612402-3000775-11-git-send-email-arnd@arndb.de> <20150930135731.GC32524@hmsreliant.think-freely.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150930135731.GC32524@hmsreliant.think-freely.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2015 at 09:57:31AM -0400, Neil Horman wrote: > On Wed, Sep 30, 2015 at 01:26:40PM +0200, Arnd Bergmann wrote: > > We want to avoid using time_t in the kernel because of the y2038 > > overflow problem. The use in sctp is not for storing seconds at > > all, but instead uses microseconds and is passed as 32-bit > > on all machines. > > > > This patch changes the type to u32, which better fits the use. > > > > Signed-off-by: Arnd Bergmann > > Cc: Vlad Yasevich > > Cc: Neil Horman > > Cc: linux-sctp@vger.kernel.org > > --- > > net/sctp/sm_make_chunk.c | 2 +- > > net/sctp/sm_statefuns.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c > > index 7954c52e1794..763e06a55155 100644 > > --- a/net/sctp/sm_make_chunk.c > > +++ b/net/sctp/sm_make_chunk.c > > @@ -2494,7 +2494,7 @@ static int sctp_process_param(struct sctp_association *asoc, > > __u16 sat; > > int retval = 1; > > sctp_scope_t scope; > > - time_t stale; > > + u32 stale; > > struct sctp_af *af; > > union sctp_addr_param *addr_param; > > struct sctp_transport *t; > > diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c > > index d7eaa7354cf7..6f46aa16cb76 100644 > > --- a/net/sctp/sm_statefuns.c > > +++ b/net/sctp/sm_statefuns.c > > @@ -2306,7 +2306,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(struct net *net, > > sctp_cmd_seq_t *commands) > > { > > struct sctp_chunk *chunk = arg; > > - time_t stale; > > + u32 stale; > > sctp_cookie_preserve_param_t bht; > > sctp_errhdr_t *err; > > struct sctp_chunk *reply; > > -- > > 2.1.0.rc2 > > > > > > Assignments to this variable use ntohl, won't this change risk overflow? > > Neil But isn't ntohl always 4 bytes long? Marcelo