lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKiknE8NSv_QMK-SzXa2SL0Vx9Ttt9NxDP2aF0wRhJGs8L4WVQ@mail.gmail.com>
Date:   Mon, 11 Dec 2017 10:41:03 +0800
From:   黃清隆 <ching2048@...ca.com.tw>
To:     Colin King <colin.king@...onical.com>
Cc:     "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH][next] scsi: arcmsr: remove redundant check for secs < 0

Colin,

You are right. That's checking is redundant. secs is never be negative.
Thanks for your correction and patch.

Regards,
Ching

2017-12-09 8:34 GMT+08:00 Colin King <colin.king@...onical.com>:
> From: Colin Ian King <colin.king@...onical.com>
>
> The check for secs being less than zero is redundant for two reasons.
> Firstly, secs is unsigned so the check is always going to be false.
> Secondly, if secs was signed the proceeding calculation of secs is
> never going to be negative.  Hence we can remove this redundant check
> and day and secs re-adjustment.
>
> Detected by static analysis with smatch:
> arcmsr_set_iop_datetime() warn: unsigned 'secs' is never less than zero.
>
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/scsi/arcmsr/arcmsr_hba.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
> index 0707a60bf5c0..e4258b69f4be 100644
> --- a/drivers/scsi/arcmsr/arcmsr_hba.c
> +++ b/drivers/scsi/arcmsr/arcmsr_hba.c
> @@ -3679,10 +3679,6 @@ static void arcmsr_set_iop_datetime(struct timer_list *t)
>         secs = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60));
>         days = secs / 86400;
>         secs = secs - 86400 * days;
> -       if (secs < 0) {
> -               days = days - 1;
> -               secs = secs + 86400;
> -       }
>         j = days / 146097;
>         i = days - 146097 * j;
>         a = i + 719468;
> --
> 2.14.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ