All of lore.kernel.org
 help / color / mirror / Atom feed
* [scsi] scsi: ufs: don't check unsigned type for a negative value
@ 2017-03-12 10:22 Tomas Winkler
  2017-03-14  0:19 ` Subhash Jadavani
  2017-03-14  3:02 ` Martin K. Petersen
  0 siblings, 2 replies; 5+ messages in thread
From: Tomas Winkler @ 2017-03-12 10:22 UTC (permalink / raw)
  To: James Bottomley, Martin K . Petersen, Vinayak Holikatti
  Cc: Christoph Hellwig, Yaniv Gardi, Subhash Jadavani, linux-scsi,
	linux-kernel, Tomas Winkler

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [scsi] scsi: ufs: don't check unsigned type for a negative value
  2017-03-12 10:22 [scsi] scsi: ufs: don't check unsigned type for a negative value Tomas Winkler
@ 2017-03-14  0:19 ` Subhash Jadavani
  2017-03-15 17:26   ` James Bottomley
  2017-03-14  3:02 ` Martin K. Petersen
  1 sibling, 1 reply; 5+ messages in thread
From: Subhash Jadavani @ 2017-03-14  0:19 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: James Bottomley, Martin K . Petersen, Vinayak Holikatti,
	Christoph Hellwig, Yaniv Gardi, linux-scsi, linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [scsi] scsi: ufs: don't check unsigned type for a negative value
  2017-03-12 10:22 [scsi] scsi: ufs: don't check unsigned type for a negative value Tomas Winkler
  2017-03-14  0:19 ` Subhash Jadavani
@ 2017-03-14  3:02 ` Martin K. Petersen
  1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2017-03-14  3:02 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: James Bottomley, Martin K . Petersen, Vinayak Holikatti,
	Christoph Hellwig, Yaniv Gardi, Subhash Jadavani, linux-scsi,
	linux-kernel

>>>>> "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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [scsi] scsi: ufs: don't check unsigned type for a negative value
  2017-03-14  0:19 ` Subhash Jadavani
@ 2017-03-15 17:26   ` James Bottomley
  2017-03-15 22:57     ` Subhash Jadavani
  0 siblings, 1 reply; 5+ messages in thread
From: James Bottomley @ 2017-03-15 17:26 UTC (permalink / raw)
  To: Subhash Jadavani, Tomas Winkler
  Cc: Martin K . Petersen, Vinayak Holikatti, Christoph Hellwig,
	Yaniv Gardi, linux-scsi, linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [scsi] scsi: ufs: don't check unsigned type for a negative value
  2017-03-15 17:26   ` James Bottomley
@ 2017-03-15 22:57     ` Subhash Jadavani
  0 siblings, 0 replies; 5+ messages in thread
From: Subhash Jadavani @ 2017-03-15 22:57 UTC (permalink / raw)
  To: James Bottomley
  Cc: Tomas Winkler, Martin K . Petersen, Vinayak Holikatti,
	Christoph Hellwig, Yaniv Gardi, linux-scsi, linux-kernel,
	linux-scsi-owner

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-15 22:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-12 10:22 [scsi] scsi: ufs: don't check unsigned type for a negative value Tomas Winkler
2017-03-14  0:19 ` Subhash Jadavani
2017-03-15 17:26   ` James Bottomley
2017-03-15 22:57     ` Subhash Jadavani
2017-03-14  3:02 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.