[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b5819922-60e0-4701-84d4-05c76d2ea5ec@acm.org>
Date: Wed, 6 Dec 2023 14:59:00 -1000
From: Bart Van Assche <bvanassche@....org>
To: Bean Huo <beanhuo@...pp.de>, avri.altman@....com,
alim.akhtar@...sung.com, jejb@...ux.ibm.com,
martin.petersen@...cle.com, mani@...nel.org, quic_cang@...cinc.com,
quic_asutoshd@...cinc.com, beanhuo@...ron.com, thomas@...ch.de
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
mikebi@...ron.com, lporzio@...ron.com
Subject: Re: [PATCH v3 2/3] scsi: ufs: core: Add UFS RTC support
On 12/2/23 06:02, Bean Huo wrote:
> +static int ufshcd_update_rtc(struct ufs_hba *hba)
> +{
> + int err;
> + u32 val;
> + struct timespec64 ts64;
> +
> + ktime_get_real_ts64(&ts64);
> + val = ts64.tv_sec - hba->dev_info.rtc_time_baseline;
A 64-bit value is truncated to a 32-bit value. What should happen if the
right hand side is larger than what fits into a 32-bit integer? Should
a comment perhaps be added that uptimes of more than 136 years are not
supported and also for absolute times that the above code fails after
the year 2010 + 136 = 2146?
Thanks,
Bart.
Powered by blists - more mailing lists