Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1598569 > unrolled thread

[scsi] scsi: ufs: don't check unsigned type for a negative value

Started byTomas Winkler <tomas.winkler@intel.com>
First post2017-03-12 11:30 +0100
Last post2017-03-14 04:10 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [scsi] scsi: ufs: don't check unsigned type for a negative value Tomas Winkler <tomas.winkler@intel.com> - 2017-03-12 11:30 +0100
    Re: [scsi] scsi: ufs: don't check unsigned type for a negative value Subhash Jadavani <subhashj@codeaurora.org> - 2017-03-14 01:20 +0100
      Re: [scsi] scsi: ufs: don't check unsigned type for a negative value James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-03-15 18:30 +0100
        Re: [scsi] scsi: ufs: don't check unsigned type for a negative value Subhash Jadavani <subhashj@codeaurora.org> - 2017-03-16 00:00 +0100
    Re: [scsi] scsi: ufs: don't check unsigned type for a negative value "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-03-14 04:10 +0100

#1598569 — [scsi] scsi: ufs: don't check unsigned type for a negative value

FromTomas Winkler <tomas.winkler@intel.com>
Date2017-03-12 11:30 +0100
Subject[scsi] scsi: ufs: don't check unsigned type for a negative value
Message-ID<tk8Vc-8tV-7@gated-at.bofh.it>
Fix compilation warning

drivers/scsi/ufs/ufshcd.c:7645:13: warning: comparison of unsigned
expression < 0 is always false [-Wtype-limits]
if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/scsi/ufs/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 1359913bf840..e8c26e6e6237 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7642,7 +7642,7 @@ static inline ssize_t ufshcd_pm_lvl_store(struct device *dev,
 	if (kstrtoul(buf, 0, &value))
 		return -EINVAL;
 
-	if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))
+	if (value >= UFS_PM_LVL_MAX)
 		return -EINVAL;
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
-- 
2.9.3

[toc] | [next] | [standalone]


#1599940

FromSubhash Jadavani <subhashj@codeaurora.org>
Date2017-03-14 01:20 +0100
Message-ID<tkIlX-or-3@gated-at.bofh.it>
In reply to#1598569
On 2017-03-12 03:22, Tomas Winkler wrote:
> Fix compilation warning
> 
> drivers/scsi/ufs/ufshcd.c:7645:13: warning: comparison of unsigned
> expression < 0 is always false [-Wtype-limits]
> if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))
> 
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 1359913bf840..e8c26e6e6237 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -7642,7 +7642,7 @@ static inline ssize_t ufshcd_pm_lvl_store(struct
> device *dev,
>  	if (kstrtoul(buf, 0, &value))
>  		return -EINVAL;
> 
> -	if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))
> +	if (value >= UFS_PM_LVL_MAX)
>  		return -EINVAL;
> 
>  	spin_lock_irqsave(hba->host->host_lock, flags);

LGTM.
Reviewed-by: Subhash Jadavani <subhashj@codaurora.org>

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [next] | [standalone]


#1601588

FromJames Bottomley <James.Bottomley@HansenPartnership.com>
Date2017-03-15 18:30 +0100
Message-ID<tlkUi-2lU-15@gated-at.bofh.it>
In reply to#1599940
On Mon, 2017-03-13 at 17:19 -0700, Subhash Jadavani wrote:
> On 2017-03-12 03:22, Tomas Winkler wrote:
> > Fix compilation warning
> > 
> > drivers/scsi/ufs/ufshcd.c:7645:13: warning: comparison of unsigned
> > expression < 0 is always false [-Wtype-limits]
> > if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))
> > 
> > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> > ---
> >  drivers/scsi/ufs/ufshcd.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index 1359913bf840..e8c26e6e6237 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -7642,7 +7642,7 @@ static inline ssize_t
> > ufshcd_pm_lvl_store(struct
> > device *dev,
> >  	if (kstrtoul(buf, 0, &value))
> >  		return -EINVAL;
> > 
> > -	if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))
> > +	if (value >= UFS_PM_LVL_MAX)
> >  		return -EINVAL;
> > 
> >  	spin_lock_irqsave(hba->host->host_lock, flags);
> 
> LGTM.
> Reviewed-by: Subhash Jadavani <subhashj@codaurora.org>

Mis-spelling someone else's email can be cut and paste; mis-spelling
your own might be the early indications of an identity crisis.

We do cut and paste these tags, so getting your own name right for the
purposes of git history is useful.

James

[toc] | [prev] | [next] | [standalone]


#1601797

FromSubhash Jadavani <subhashj@codeaurora.org>
Date2017-03-16 00:00 +0100
Message-ID<tlq3E-5Uw-13@gated-at.bofh.it>
In reply to#1601588
On 2017-03-15 10:26, James Bottomley wrote:
> On Mon, 2017-03-13 at 17:19 -0700, Subhash Jadavani wrote:
>> On 2017-03-12 03:22, Tomas Winkler wrote:
>> > Fix compilation warning
>> >
>> > drivers/scsi/ufs/ufshcd.c:7645:13: warning: comparison of unsigned
>> > expression < 0 is always false [-Wtype-limits]
>> > if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))
>> >
>> > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
>> > ---
>> >  drivers/scsi/ufs/ufshcd.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> > index 1359913bf840..e8c26e6e6237 100644
>> > --- a/drivers/scsi/ufs/ufshcd.c
>> > +++ b/drivers/scsi/ufs/ufshcd.c
>> > @@ -7642,7 +7642,7 @@ static inline ssize_t
>> > ufshcd_pm_lvl_store(struct
>> > device *dev,
>> >  	if (kstrtoul(buf, 0, &value))
>> >  		return -EINVAL;
>> >
>> > -	if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX))
>> > +	if (value >= UFS_PM_LVL_MAX)
>> >  		return -EINVAL;
>> >
>> >  	spin_lock_irqsave(hba->host->host_lock, flags);
>> 
>> LGTM.
>> Reviewed-by: Subhash Jadavani <subhashj@codaurora.org>
> 
> Mis-spelling someone else's email can be cut and paste; mis-spelling
> your own might be the early indications of an identity crisis.
> 
> We do cut and paste these tags, so getting your own name right for the
> purposes of git history is useful.
> 
> James

Oops, sorry for this. If you haven't already corrected this:
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>



-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [next] | [standalone]


#1600008

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2017-03-14 04:10 +0100
Message-ID<tkL0u-2gr-3@gated-at.bofh.it>
In reply to#1598569
>>>>> "Tomas" == Tomas Winkler <tomas.winkler@intel.com> writes:

Tomas> Fix compilation warning drivers/scsi/ufs/ufshcd.c:7645:13:
Tomas> warning: comparison of unsigned expression < 0 is always false
Tomas> [-Wtype-limits] if ((value < UFS_PM_LVL_0) || (value >=
Tomas> UFS_PM_LVL_MAX))

Applied to 4.11/scsi-fixes, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web