mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Bean Huo <beanhuo@iokpp.de>,
	avri.altman@wdc.com, alim.akhtar@samsung.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, mani@kernel.org,
	quic_cang@quicinc.com, quic_asutoshd@quicinc.com,
	beanhuo@micron.com, thomas@t-8ch.de
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	mikebi@micron.com, lporzio@micron.com
Subject: Re: [PATCH v3 2/3] scsi: ufs: core: Add UFS RTC support
Date: Wed, 6 Dec 2023 14:59:00 -1000	[thread overview]
Message-ID: <b5819922-60e0-4701-84d4-05c76d2ea5ec@acm.org> (raw)
In-Reply-To: <20231202160227.766529-3-beanhuo@iokpp.de>

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.

  parent reply	other threads:[~2023-12-07  1:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-02 16:02 [PATCH v3 0/3] " Bean Huo
2023-12-02 16:02 ` [PATCH v3 1/3] scsi: ufs: core: Add ufshcd_is_ufs_dev_busy() Bean Huo
2023-12-06 19:36   ` Avri Altman
2023-12-02 16:02 ` [PATCH v3 2/3] scsi: ufs: core: Add UFS RTC support Bean Huo
2023-12-04 12:13   ` Avri Altman
2023-12-04 12:23     ` Avri Altman
2023-12-06 19:38   ` Avri Altman
2023-12-07  0:59   ` Bart Van Assche [this message]
2023-12-07 23:02     ` Bean Huo
2023-12-02 16:02 ` [PATCH v3 3/3] scsi: ufs: core: Add sysfs node for UFS RTC update Bean Huo
2023-12-06 19:39   ` Avri Altman
2023-12-06 17:08 ` [PATCH v3 0/3] Add UFS RTC support Bean Huo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5819922-60e0-4701-84d4-05c76d2ea5ec@acm.org \
    --to=bvanassche@acm.org \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@iokpp.de \
    --cc=beanhuo@micron.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lporzio@micron.com \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mikebi@micron.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=quic_cang@quicinc.com \
    --cc=thomas@t-8ch.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®