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


Groups > linux.kernel > #1220958 > unrolled thread

[PATCH 2/2] staging: lustre: lov: remove always false condition

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2015-09-08 18:30 +0200
Last post2015-09-08 19:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] staging: lustre: lov: remove always false condition Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-08 18:30 +0200
    Re: [PATCH 2/2] staging: lustre: lov: remove always false condition Joe Perches <joe@perches.com> - 2015-09-08 19:00 +0200
      Re: [PATCH 2/2] staging: lustre: lov: remove always false condition Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-08 19:50 +0200

#1220958 — [PATCH 2/2] staging: lustre: lov: remove always false condition

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-08 18:30 +0200
Subject[PATCH 2/2] staging: lustre: lov: remove always false condition
Message-ID<q6tWq-16N-7@gated-at.bofh.it>
The member qc_idx of struct if_quotactl is unsigned and hence it can
never be less than zero.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/lustre/lustre/lov/lov_obd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 2a2fd8d..906503b 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1487,7 +1487,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		struct obd_quotactl *oqctl;
 
 		if (qctl->qc_valid == QC_OSTIDX) {
-			if (qctl->qc_idx < 0 || count <= qctl->qc_idx)
+			if (count <= qctl->qc_idx)
 				return -EINVAL;
 
 			tgt = lov->lov_tgts[qctl->qc_idx];
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1220990

FromJoe Perches <joe@perches.com>
Date2015-09-08 19:00 +0200
Message-ID<q6upt-1Fu-7@gated-at.bofh.it>
In reply to#1220958
On Tue, 2015-09-08 at 21:53 +0530, Sudip Mukherjee wrote:
> The member qc_idx of struct if_quotactl is unsigned and hence it can
> never be less than zero.
[]
> diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
[]
> @@ -1487,7 +1487,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
>  		struct obd_quotactl *oqctl;
>  
>  		if (qctl->qc_valid == QC_OSTIDX) {
> -			if (qctl->qc_idx < 0 || count <= qctl->qc_idx)
> +			if (count <= qctl->qc_idx)

Perhaps this test would be clearer reversed too

			if (qctl->qc_idx >= count)

>  				return -EINVAL;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


#1221024

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-08 19:50 +0200
Message-ID<q6vbQ-2PL-31@gated-at.bofh.it>
In reply to#1220990
On Tue, Sep 08, 2015 at 09:53:09AM -0700, Joe Perches wrote:
> On Tue, 2015-09-08 at 21:53 +0530, Sudip Mukherjee wrote:
> >  		if (qctl->qc_valid == QC_OSTIDX) {
> > -			if (qctl->qc_idx < 0 || count <= qctl->qc_idx)
> > +			if (count <= qctl->qc_idx)
> 
> Perhaps this test would be clearer reversed too
> 
> 			if (qctl->qc_idx >= count)
There are more such comparison in that file, like:
1) if (ost_idx >= lov->desc.ld_tgt_count)
2) if (index >= lov->lov_tgt_size)
and some more.
And if I include it in this patch then it will become separate change.
I will better send a separate patch for this.

Regards
Sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web