All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07 ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: linux-rdma
  Cc: devel, linux-s390, linux-fbdev, linux-scsi, iss_storagedev,
	linux-sh, kernel-janitors, linux-wireless, linux-kernel, ath10k,
	adi-buildroot-devel, netdev

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.


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

* [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07 ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: linux-rdma
  Cc: kernel-janitors, linux-fbdev, linux-sh, linux-kernel, ath10k,
	linux-wireless, netdev, devel, iss_storagedev, linux-scsi,
	linux-s390, adi-buildroot-devel

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.


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

* [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07 ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: linux-rdma
  Cc: devel, linux-s390, linux-fbdev, linux-scsi, iss_storagedev,
	linux-sh, kernel-janitors, linux-wireless, linux-kernel, ath10k,
	adi-buildroot-devel, netdev

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

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

* [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07 ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: linux-rdma
  Cc: devel, linux-s390, linux-fbdev, linux-scsi, iss_storagedev,
	linux-sh, kernel-janitors, linux-wireless, linux-kernel, ath10k,
	adi-buildroot-devel, netdev

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* [PATCH 1/10] sh: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kernel-janitors, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, linux-kernel, linux-sh

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/sh/kernel/perf_event.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -281,7 +281,7 @@ static int sh_pmu_add(struct perf_event
 
 	if (__test_and_set_bit(idx, cpuc->used_mask)) {
 		idx = find_first_zero_bit(cpuc->used_mask, sh_pmu->num_events);
-		if (idx = sh_pmu->num_events)
+		if (idx >= sh_pmu->num_events)
 			goto out;
 
 		__set_bit(idx, cpuc->used_mask);


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

* [PATCH 1/10] sh: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kernel-janitors, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, linux-kernel, linux-sh

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/sh/kernel/perf_event.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -281,7 +281,7 @@ static int sh_pmu_add(struct perf_event
 
 	if (__test_and_set_bit(idx, cpuc->used_mask)) {
 		idx = find_first_zero_bit(cpuc->used_mask, sh_pmu->num_events);
-		if (idx == sh_pmu->num_events)
+		if (idx >= sh_pmu->num_events)
 			goto out;
 
 		__set_bit(idx, cpuc->used_mask);


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

* [PATCH 2/10] ath10k: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
  (?)
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Kalle Valo
  Cc: kernel-janitors, John W. Linville, ath10k, linux-wireless,
	netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/net/wireless/ath/ath10k/htt_tx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -64,7 +64,7 @@ int ath10k_htt_tx_alloc_msdu_id(struct a
 
 	msdu_id = find_first_zero_bit(htt->used_msdu_ids,
 				      htt->max_num_pending_tx);
-	if (msdu_id == htt->max_num_pending_tx)
+	if (msdu_id >= htt->max_num_pending_tx)
 		return -ENOBUFS;
 
 	ath10k_dbg(ATH10K_DBG_HTT, "htt tx alloc msdu_id %d\n", msdu_id);


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

* [PATCH 2/10] ath10k: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Kalle Valo
  Cc: kernel-janitors, linux-wireless, linux-kernel, ath10k,
	John W. Linville, netdev

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/net/wireless/ath/ath10k/htt_tx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -64,7 +64,7 @@ int ath10k_htt_tx_alloc_msdu_id(struct a
 
 	msdu_id = find_first_zero_bit(htt->used_msdu_ids,
 				      htt->max_num_pending_tx);
-	if (msdu_id = htt->max_num_pending_tx)
+	if (msdu_id >= htt->max_num_pending_tx)
 		return -ENOBUFS;
 
 	ath10k_dbg(ATH10K_DBG_HTT, "htt tx alloc msdu_id %d\n", msdu_id);


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

* [PATCH 2/10] ath10k: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Kalle Valo
  Cc: kernel-janitors, linux-wireless, linux-kernel, ath10k,
	John W. Linville, netdev

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/net/wireless/ath/ath10k/htt_tx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -64,7 +64,7 @@ int ath10k_htt_tx_alloc_msdu_id(struct a
 
 	msdu_id = find_first_zero_bit(htt->used_msdu_ids,
 				      htt->max_num_pending_tx);
-	if (msdu_id == htt->max_num_pending_tx)
+	if (msdu_id >= htt->max_num_pending_tx)
 		return -ENOBUFS;
 
 	ath10k_dbg(ATH10K_DBG_HTT, "htt tx alloc msdu_id %d\n", msdu_id);


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* [PATCH 3/10] video: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Jean-Christophe Plagniol-Villard
  Cc: kernel-janitors, Tomi Valkeinen, linux-fbdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/video/fbdev/sh_mobile_meram.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/video/fbdev/sh_mobile_meram.c b/drivers/video/fbdev/sh_mobile_meram.c
--- a/drivers/video/fbdev/sh_mobile_meram.c
+++ b/drivers/video/fbdev/sh_mobile_meram.c
@@ -222,7 +222,7 @@ static int meram_plane_alloc(struct sh_m
 	unsigned long idx;
 
 	idx = find_first_zero_bit(&priv->used_icb, 28);
-	if (idx == 28)
+	if (idx >= 28)
 		return -ENOMEM;
 	plane->cache = &priv->icbs[idx];
 


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

* [PATCH 3/10] video: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Jean-Christophe Plagniol-Villard
  Cc: kernel-janitors, Tomi Valkeinen, linux-fbdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/video/fbdev/sh_mobile_meram.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/video/fbdev/sh_mobile_meram.c b/drivers/video/fbdev/sh_mobile_meram.c
--- a/drivers/video/fbdev/sh_mobile_meram.c
+++ b/drivers/video/fbdev/sh_mobile_meram.c
@@ -222,7 +222,7 @@ static int meram_plane_alloc(struct sh_m
 	unsigned long idx;
 
 	idx = find_first_zero_bit(&priv->used_icb, 28);
-	if (idx = 28)
+	if (idx >= 28)
 		return -ENOMEM;
 	plane->cache = &priv->icbs[idx];
 


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

* [PATCH 4/10] staging: tidspbridge: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Omar Ramirez Luna
  Cc: kernel-janitors, Greg Kroah-Hartman, devel, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/staging/tidspbridge/rmgr/node.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -935,7 +935,7 @@ int node_connect(struct node_object *nod
 				 node2_type == NODE_DAISSOCKET)) {
 		/* Find available pipe */
 		pipe_id = find_first_zero_bit(hnode_mgr->pipe_map, MAXPIPES);
-		if (pipe_id == MAXPIPES) {
+		if (pipe_id >= MAXPIPES) {
 			status = -ECONNREFUSED;
 			goto out_unlock;
 		}
@@ -1008,7 +1008,7 @@ int node_connect(struct node_object *nod
 			status = -EINVAL;
 			goto out_unlock;
 		}
-		if (chnl_id == CHNL_MAXCHANNELS) {
+		if (chnl_id >= CHNL_MAXCHANNELS) {
 			status = -ECONNREFUSED;
 			goto out_unlock;
 		}


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

* [PATCH 4/10] staging: tidspbridge: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Omar Ramirez Luna
  Cc: kernel-janitors, Greg Kroah-Hartman, devel, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/staging/tidspbridge/rmgr/node.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -935,7 +935,7 @@ int node_connect(struct node_object *nod
 				 node2_type = NODE_DAISSOCKET)) {
 		/* Find available pipe */
 		pipe_id = find_first_zero_bit(hnode_mgr->pipe_map, MAXPIPES);
-		if (pipe_id = MAXPIPES) {
+		if (pipe_id >= MAXPIPES) {
 			status = -ECONNREFUSED;
 			goto out_unlock;
 		}
@@ -1008,7 +1008,7 @@ int node_connect(struct node_object *nod
 			status = -EINVAL;
 			goto out_unlock;
 		}
-		if (chnl_id = CHNL_MAXCHANNELS) {
+		if (chnl_id >= CHNL_MAXCHANNELS) {
 			status = -ECONNREFUSED;
 			goto out_unlock;
 		}


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

* [PATCH 5/10] ARC: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kernel-janitors, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Vineet Gupta, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/arc/kernel/perf_event.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -205,7 +205,7 @@ static int arc_pmu_add(struct perf_event
 	if (__test_and_set_bit(idx, arc_pmu->used_mask)) {
 		idx = find_first_zero_bit(arc_pmu->used_mask,
 					  arc_pmu->n_counters);
-		if (idx == arc_pmu->n_counters)
+		if (idx >= arc_pmu->n_counters)
 			return -EAGAIN;
 
 		__set_bit(idx, arc_pmu->used_mask);


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

* [PATCH 5/10] ARC: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kernel-janitors, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Vineet Gupta, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/arc/kernel/perf_event.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -205,7 +205,7 @@ static int arc_pmu_add(struct perf_event
 	if (__test_and_set_bit(idx, arc_pmu->used_mask)) {
 		idx = find_first_zero_bit(arc_pmu->used_mask,
 					  arc_pmu->n_counters);
-		if (idx = arc_pmu->n_counters)
+		if (idx >= arc_pmu->n_counters)
 			return -EAGAIN;
 
 		__set_bit(idx, arc_pmu->used_mask);


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

* [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Stephen M. Cameron
  Cc: kernel-janitors, James E.J. Bottomley, iss_storagedev,
	linux-scsi, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/scsi/hpsa.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
 	spin_lock_irqsave(&h->lock, flags);
 	do {
 		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
-		if (i == h->nr_cmds) {
+		if (i >= h->nr_cmds) {
 			spin_unlock_irqrestore(&h->lock, flags);
 			return NULL;
 		}


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

* [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Stephen M. Cameron
  Cc: kernel-janitors, James E.J. Bottomley, iss_storagedev,
	linux-scsi, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/scsi/hpsa.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
 	spin_lock_irqsave(&h->lock, flags);
 	do {
 		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
-		if (i = h->nr_cmds) {
+		if (i >= h->nr_cmds) {
 			spin_unlock_irqrestore(&h->lock, flags);
 			return NULL;
 		}


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

* [PATCH 7/10] cciss: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Mike Miller; +Cc: kernel-janitors, iss_storagedev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/block/cciss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/block/cciss.c b/drivers/block/cciss.c
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -980,7 +980,7 @@ static CommandList_struct *cmd_alloc(ctl
 
 	do {
 		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
-		if (i == h->nr_cmds)
+		if (i >= h->nr_cmds)
 			return NULL;
 	} while (test_and_set_bit(i, h->cmd_pool_bits) != 0);
 	c = h->cmd_pool + i;


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

* [PATCH 7/10] cciss: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Mike Miller; +Cc: kernel-janitors, iss_storagedev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/block/cciss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/block/cciss.c b/drivers/block/cciss.c
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -980,7 +980,7 @@ static CommandList_struct *cmd_alloc(ctl
 
 	do {
 		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
-		if (i = h->nr_cmds)
+		if (i >= h->nr_cmds)
 			return NULL;
 	} while (test_and_set_bit(i, h->cmd_pool_bits) != 0);
 	c = h->cmd_pool + i;


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

* [PATCH 8/10] s390/pci: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Sebastian Ott
  Cc: kernel-janitors, Gerald Schaefer, Martin Schwidefsky,
	Heiko Carstens, linux390, linux-s390, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/s390/pci/pci.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -566,7 +566,7 @@ static int zpci_alloc_iomap(struct zpci_
 
 	spin_lock(&zpci_iomap_lock);
 	entry = find_first_zero_bit(zpci_iomap, ZPCI_IOMAP_MAX_ENTRIES);
-	if (entry == ZPCI_IOMAP_MAX_ENTRIES) {
+	if (entry >= ZPCI_IOMAP_MAX_ENTRIES) {
 		spin_unlock(&zpci_iomap_lock);
 		return -ENOSPC;
 	}
@@ -746,7 +746,7 @@ static int zpci_alloc_domain(struct zpci
 {
 	spin_lock(&zpci_domain_lock);
 	zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES);
-	if (zdev->domain == ZPCI_NR_DEVICES) {
+	if (zdev->domain >= ZPCI_NR_DEVICES) {
 		spin_unlock(&zpci_domain_lock);
 		return -ENOSPC;
 	}


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

* [PATCH 8/10] s390/pci: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Sebastian Ott
  Cc: kernel-janitors, Gerald Schaefer, Martin Schwidefsky,
	Heiko Carstens, linux390, linux-s390, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/s390/pci/pci.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -566,7 +566,7 @@ static int zpci_alloc_iomap(struct zpci_
 
 	spin_lock(&zpci_iomap_lock);
 	entry = find_first_zero_bit(zpci_iomap, ZPCI_IOMAP_MAX_ENTRIES);
-	if (entry = ZPCI_IOMAP_MAX_ENTRIES) {
+	if (entry >= ZPCI_IOMAP_MAX_ENTRIES) {
 		spin_unlock(&zpci_iomap_lock);
 		return -ENOSPC;
 	}
@@ -746,7 +746,7 @@ static int zpci_alloc_domain(struct zpci
 {
 	spin_lock(&zpci_domain_lock);
 	zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES);
-	if (zdev->domain = ZPCI_NR_DEVICES) {
+	if (zdev->domain >= ZPCI_NR_DEVICES) {
 		spin_unlock(&zpci_domain_lock);
 		return -ENOSPC;
 	}


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

* [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:07   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Mike Marciniszyn
  Cc: kernel-janitors, Roland Dreier, Sean Hefty, Hal Rosenstock,
	linux-rdma, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/infiniband/hw/qib/qib_file_ops.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c
--- a/drivers/infiniband/hw/qib/qib_file_ops.c
+++ b/drivers/infiniband/hw/qib/qib_file_ops.c
@@ -1187,7 +1187,7 @@ static void assign_ctxt_affinity(struct
 		int cpu;
 		cpu = find_first_zero_bit(qib_cpulist,
 					  qib_cpulist_count);
-		if (cpu == qib_cpulist_count)
+		if (cpu >= qib_cpulist_count)
 			qib_dev_err(dd,
 			"no cpus avail for affinity PID %u\n",
 			current->pid);

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

* [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:07   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:07 UTC (permalink / raw)
  To: Mike Marciniszyn
  Cc: kernel-janitors, Roland Dreier, Sean Hefty, Hal Rosenstock,
	linux-rdma, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/infiniband/hw/qib/qib_file_ops.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c
--- a/drivers/infiniband/hw/qib/qib_file_ops.c
+++ b/drivers/infiniband/hw/qib/qib_file_ops.c
@@ -1187,7 +1187,7 @@ static void assign_ctxt_affinity(struct
 		int cpu;
 		cpu = find_first_zero_bit(qib_cpulist,
 					  qib_cpulist_count);
-		if (cpu = qib_cpulist_count)
+		if (cpu >= qib_cpulist_count)
 			qib_dev_err(dd,
 			"no cpus avail for affinity PID %u\n",
 			current->pid);


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

* [PATCH 10/10] blackfin: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
@ 2014-06-04  9:08   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:08 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kernel-janitors, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Steven Miao, linux-kernel,
	adi-buildroot-devel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- ==
+ >=
  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/blackfin/kernel/perf_event.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/arch/blackfin/kernel/perf_event.c b/arch/blackfin/kernel/perf_event.c
--- a/arch/blackfin/kernel/perf_event.c
+++ b/arch/blackfin/kernel/perf_event.c
@@ -354,7 +354,7 @@ static int bfin_pmu_add(struct perf_even
 
 	if (__test_and_set_bit(idx, cpuc->used_mask)) {
 		idx = find_first_zero_bit(cpuc->used_mask, MAX_HWEVENTS);
-		if (idx == MAX_HWEVENTS)
+		if (idx >= MAX_HWEVENTS)
 			goto out;
 
 		__set_bit(idx, cpuc->used_mask);


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

* [PATCH 10/10] blackfin: use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:08   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:08 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: kernel-janitors, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Steven Miao, linux-kernel,
	adi-buildroot-devel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
return a larger number than the maximum position argument if that position
is not a multiple of BITS_PER_LONG.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,e3;
statement S1,S2;
@@

e1 = find_first_zero_bit(e2,e3)
...
if (e1 
- =
+ >  e3)
S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 arch/blackfin/kernel/perf_event.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/arch/blackfin/kernel/perf_event.c b/arch/blackfin/kernel/perf_event.c
--- a/arch/blackfin/kernel/perf_event.c
+++ b/arch/blackfin/kernel/perf_event.c
@@ -354,7 +354,7 @@ static int bfin_pmu_add(struct perf_even
 
 	if (__test_and_set_bit(idx, cpuc->used_mask)) {
 		idx = find_first_zero_bit(cpuc->used_mask, MAX_HWEVENTS);
-		if (idx = MAX_HWEVENTS)
+		if (idx >= MAX_HWEVENTS)
 			goto out;
 
 		__set_bit(idx, cpuc->used_mask);


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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04  9:07 ` Julia Lawall
  (?)
  (?)
@ 2014-06-04  9:35   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04  9:35 UTC (permalink / raw)
  To: Julia Lawall
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	netdev

Hi Julia,

On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.

Shouldn't this be fixed in find_first_zero_bit() instead?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:35   ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04  9:35 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-rdma, kernel-janitors, Linux Fbdev development list,
	Linux-sh list, linux-kernel, ath10k, linux-wireless, netdev,
	driverdevel, iss_storagedev, scsi, linux-s390,
	adi-buildroot-devel

Hi Julia,

On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.

Shouldn't this be fixed in find_first_zero_bit() instead?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:35   ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04  9:35 UTC (permalink / raw)
  To: Julia Lawall
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	netdev

Hi Julia,

On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.

Shouldn't this be fixed in find_first_zero_bit() instead?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:35   ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04  9:35 UTC (permalink / raw)
  To: Julia Lawall
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	netdev

Hi Julia,

On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.

Shouldn't this be fixed in find_first_zero_bit() instead?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04  9:35   ` Geert Uytterhoeven
                         ` (2 preceding siblings ...)
  (?)
@ 2014-06-04  9:38       ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, linux-rdma, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Linux Fbdev development list, Linux-sh list,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-wireless,
	netdev-u79uwXL29TY76Z2rM5mHXA, driverdevel,
	iss_storagedev-VXdhtT5mjnY, scsi, linux-s390,
	adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
>
> Shouldn't this be fixed in find_first_zero_bit() instead?

OK, I could do that as well.  Most of the callers currently test with >=.
Should they be left as is, or changed to use =?

julia

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:38       ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
>
> Shouldn't this be fixed in find_first_zero_bit() instead?

OK, I could do that as well.  Most of the callers currently test with >=.
Should they be left as is, or changed to use ==?

julia

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:38       ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, linux-rdma, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Linux Fbdev development list, Linux-sh list,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-wireless,
	netdev-u79uwXL29TY76Z2rM5mHXA, driverdevel,
	iss_storagedev-VXdhtT5mjnY, scsi, linux-s390,
	adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org> wrote:
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
>
> Shouldn't this be fixed in find_first_zero_bit() instead?

OK, I could do that as well.  Most of the callers currently test with >=.
Should they be left as is, or changed to use ==?

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:38       ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Julia Lawall, netdev



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
>
> Shouldn't this be fixed in find_first_zero_bit() instead?

OK, I could do that as well.  Most of the callers currently test with >=.
Should they be left as is, or changed to use ==?

julia

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:38       ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Julia Lawall, netdev



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
>
> Shouldn't this be fixed in find_first_zero_bit() instead?

OK, I could do that as well.  Most of the callers currently test with >=.
Should they be left as is, or changed to use =?

julia

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04  9:38       ` Julia Lawall
                           ` (3 preceding siblings ...)
  (?)
@ 2014-06-04  9:46         ` David Laight
  -1 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04  9:46 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: linux-rdma, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Linux Fbdev development list, Linux-sh list,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-wireless,
	netdev-u79uwXL29TY76Z2rM5mHXA, driverdevel,
	iss_storagedev-VXdhtT5mjnY, scsi, linux-s390,
	adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > return a larger number than the maximum position argument if that position
> > > is not a multiple of BITS_PER_LONG.
> >
> > Shouldn't this be fixed in find_first_zero_bit() instead?
> 
> OK, I could do that as well.  Most of the callers currently test with >=.
> Should they be left as is, or changed to use =?

Do we want to add an extra test to find_first_zero_bit() and effectively
slow down all the calls - especially those where the length is a
multiple of 8 (probably the most common).

Maybe the documented return code should be changed to allow for the
existing behaviour.

	David




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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:46         ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04  9:46 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: linux-rdma, kernel-janitors, Linux Fbdev development list,
	Linux-sh list, linux-kernel, ath10k, linux-wireless, netdev,
	driverdevel, iss_storagedev, scsi, linux-s390,
	adi-buildroot-devel

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > return a larger number than the maximum position argument if that position
> > > is not a multiple of BITS_PER_LONG.
> >
> > Shouldn't this be fixed in find_first_zero_bit() instead?
> 
> OK, I could do that as well.  Most of the callers currently test with >=.
> Should they be left as is, or changed to use ==?

Do we want to add an extra test to find_first_zero_bit() and effectively
slow down all the calls - especially those where the length is a
multiple of 8 (probably the most common).

Maybe the documented return code should be changed to allow for the
existing behaviour.

	David




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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:46         ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04  9:46 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: linux-rdma, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Linux Fbdev development list, Linux-sh list,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-wireless,
	netdev-u79uwXL29TY76Z2rM5mHXA, driverdevel,
	iss_storagedev-VXdhtT5mjnY, scsi, linux-s390,
	adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org> wrote:
> > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > return a larger number than the maximum position argument if that position
> > > is not a multiple of BITS_PER_LONG.
> >
> > Shouldn't this be fixed in find_first_zero_bit() instead?
> 
> OK, I could do that as well.  Most of the callers currently test with >=.
> Should they be left as is, or changed to use ==?

Do we want to add an extra test to find_first_zero_bit() and effectively
slow down all the calls - especially those where the length is a
multiple of 8 (probably the most common).

Maybe the documented return code should be changed to allow for the
existing behaviour.

	David



--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:46         ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04  9:46 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: linux-rdma, kernel-janitors, Linux Fbdev development list,
	Linux-sh list, linux-kernel, ath10k, linux-wireless, netdev,
	driverdevel, iss_storagedev, scsi, linux-s390,
	adi-buildroot-devel

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > return a larger number than the maximum position argument if that position
> > > is not a multiple of BITS_PER_LONG.
> >
> > Shouldn't this be fixed in find_first_zero_bit() instead?
> 
> OK, I could do that as well.  Most of the callers currently test with >=.
> Should they be left as is, or changed to use ==?

Do we want to add an extra test to find_first_zero_bit() and effectively
slow down all the calls - especially those where the length is a
multiple of 8 (probably the most common).

Maybe the documented return code should be changed to allow for the
existing behaviour.

	David




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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:46         ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04  9:46 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	netdev

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > return a larger number than the maximum position argument if that position
> > > is not a multiple of BITS_PER_LONG.
> >
> > Shouldn't this be fixed in find_first_zero_bit() instead?
> 
> OK, I could do that as well.  Most of the callers currently test with >=.
> Should they be left as is, or changed to use ==?

Do we want to add an extra test to find_first_zero_bit() and effectively
slow down all the calls - especially those where the length is a
multiple of 8 (probably the most common).

Maybe the documented return code should be changed to allow for the
existing behaviour.

	David




_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:46         ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04  9:46 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	netdev

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > return a larger number than the maximum position argument if that position
> > > is not a multiple of BITS_PER_LONG.
> >
> > Shouldn't this be fixed in find_first_zero_bit() instead?
> 
> OK, I could do that as well.  Most of the callers currently test with >=.
> Should they be left as is, or changed to use =?

Do we want to add an extra test to find_first_zero_bit() and effectively
slow down all the calls - especially those where the length is a
multiple of 8 (probably the most common).

Maybe the documented return code should be changed to allow for the
existing behaviour.

	David




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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04  9:46         ` David Laight
                             ` (2 preceding siblings ...)
  (?)
@ 2014-06-04  9:52           ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:52 UTC (permalink / raw)
  To: David Laight
  Cc: 'Julia Lawall',
	Geert Uytterhoeven, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel



On Wed, 4 Jun 2014, David Laight wrote:

> From: Julia Lawall
> > On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> >
> > > Hi Julia,
> > >
> > > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > > return a larger number than the maximum position argument if that position
> > > > is not a multiple of BITS_PER_LONG.
> > >
> > > Shouldn't this be fixed in find_first_zero_bit() instead?
> >
> > OK, I could do that as well.  Most of the callers currently test with >=.
> > Should they be left as is, or changed to use =?
>
> Do we want to add an extra test to find_first_zero_bit() and effectively
> slow down all the calls - especially those where the length is a
> multiple of 8 (probably the most common).

Currently, most of the calls test with >=, and most of the others seem to
need to (either the size value did not look like a multiple of anything in
particular, or it was eg read from a device).

Note that it is BITS_PER_LONG, so it seems like it is typically 32 or 64,
not 8.

> Maybe the documented return code should be changed to allow for the
> existing behaviour.

Sorry, I'm not sure to understand what you suggest here.

thanks,
julia

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:52           ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:52 UTC (permalink / raw)
  To: David Laight
  Cc: 'Julia Lawall',
	Geert Uytterhoeven, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel



On Wed, 4 Jun 2014, David Laight wrote:

> From: Julia Lawall
> > On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> >
> > > Hi Julia,
> > >
> > > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > > return a larger number than the maximum position argument if that position
> > > > is not a multiple of BITS_PER_LONG.
> > >
> > > Shouldn't this be fixed in find_first_zero_bit() instead?
> >
> > OK, I could do that as well.  Most of the callers currently test with >=.
> > Should they be left as is, or changed to use ==?
>
> Do we want to add an extra test to find_first_zero_bit() and effectively
> slow down all the calls - especially those where the length is a
> multiple of 8 (probably the most common).

Currently, most of the calls test with >=, and most of the others seem to
need to (either the size value did not look like a multiple of anything in
particular, or it was eg read from a device).

Note that it is BITS_PER_LONG, so it seems like it is typically 32 or 64,
not 8.

> Maybe the documented return code should be changed to allow for the
> existing behaviour.

Sorry, I'm not sure to understand what you suggest here.

thanks,
julia

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:52           ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:52 UTC (permalink / raw)
  To: David Laight
  Cc: 'Julia Lawall',
	Geert Uytterhoeven, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel



On Wed, 4 Jun 2014, David Laight wrote:

> From: Julia Lawall
> > On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> >
> > > Hi Julia,
> > >
> > > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > > return a larger number than the maximum position argument if that position
> > > > is not a multiple of BITS_PER_LONG.
> > >
> > > Shouldn't this be fixed in find_first_zero_bit() instead?
> >
> > OK, I could do that as well.  Most of the callers currently test with >=.
> > Should they be left as is, or changed to use ==?
>
> Do we want to add an extra test to find_first_zero_bit() and effectively
> slow down all the calls - especially those where the length is a
> multiple of 8 (probably the most common).

Currently, most of the calls test with >=, and most of the others seem to
need to (either the size value did not look like a multiple of anything in
particular, or it was eg read from a device).

Note that it is BITS_PER_LONG, so it seems like it is typically 32 or 64,
not 8.

> Maybe the documented return code should be changed to allow for the
> existing behaviour.

Sorry, I'm not sure to understand what you suggest here.

thanks,
julia

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:52           ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:52 UTC (permalink / raw)
  To: David Laight
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	'Julia Lawall',
	Geert Uytterhoeven, netdev



On Wed, 4 Jun 2014, David Laight wrote:

> From: Julia Lawall
> > On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> >
> > > Hi Julia,
> > >
> > > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > > return a larger number than the maximum position argument if that position
> > > > is not a multiple of BITS_PER_LONG.
> > >
> > > Shouldn't this be fixed in find_first_zero_bit() instead?
> >
> > OK, I could do that as well.  Most of the callers currently test with >=.
> > Should they be left as is, or changed to use ==?
>
> Do we want to add an extra test to find_first_zero_bit() and effectively
> slow down all the calls - especially those where the length is a
> multiple of 8 (probably the most common).

Currently, most of the calls test with >=, and most of the others seem to
need to (either the size value did not look like a multiple of anything in
particular, or it was eg read from a device).

Note that it is BITS_PER_LONG, so it seems like it is typically 32 or 64,
not 8.

> Maybe the documented return code should be changed to allow for the
> existing behaviour.

Sorry, I'm not sure to understand what you suggest here.

thanks,
julia

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04  9:52           ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04  9:52 UTC (permalink / raw)
  To: David Laight
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	'Julia Lawall',
	Geert Uytterhoeven, netdev



On Wed, 4 Jun 2014, David Laight wrote:

> From: Julia Lawall
> > On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> >
> > > Hi Julia,
> > >
> > > On Wed, Jun 4, 2014 at 11:07 AM, Julia Lawall <Julia.Lawall@lip6.fr> wrote:
> > > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > > return a larger number than the maximum position argument if that position
> > > > is not a multiple of BITS_PER_LONG.
> > >
> > > Shouldn't this be fixed in find_first_zero_bit() instead?
> >
> > OK, I could do that as well.  Most of the callers currently test with >=.
> > Should they be left as is, or changed to use =?
>
> Do we want to add an extra test to find_first_zero_bit() and effectively
> slow down all the calls - especially those where the length is a
> multiple of 8 (probably the most common).

Currently, most of the calls test with >=, and most of the others seem to
need to (either the size value did not look like a multiple of anything in
particular, or it was eg read from a device).

Note that it is BITS_PER_LONG, so it seems like it is typically 32 or 64,
not 8.

> Maybe the documented return code should be changed to allow for the
> existing behaviour.

Sorry, I'm not sure to understand what you suggest here.

thanks,
julia

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04  9:52           ` Julia Lawall
                               ` (2 preceding siblings ...)
  (?)
@ 2014-06-04 10:55             ` Geert Uytterhoeven
  -1 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 10:55 UTC (permalink / raw)
  To: Julia Lawall
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	David Laight, Arnd Bergmann, netdev

Hi Julia,

On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> Maybe the documented return code should be changed to allow for the
>> existing behaviour.
>
> Sorry, I'm not sure to understand what you suggest here.

include/asm-generic/bitops/find.h:

| /**
|  * find_first_zero_bit - find the first cleared bit in a memory region
|  * @addr: The address to start the search at
|  * @size: The maximum number of bits to search
|  *
|  * Returns the bit number of the first cleared bit.
|  * If no bits are zero, returns @size.

"If no bits are zero, returns @size or a number larger than @size."

|  */
| extern unsigned long find_first_zero_bit(const unsigned long *addr,
|                                          unsigned long size);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 10:55             ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 10:55 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann

Hi Julia,

On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> Maybe the documented return code should be changed to allow for the
>> existing behaviour.
>
> Sorry, I'm not sure to understand what you suggest here.

include/asm-generic/bitops/find.h:

| /**
|  * find_first_zero_bit - find the first cleared bit in a memory region
|  * @addr: The address to start the search at
|  * @size: The maximum number of bits to search
|  *
|  * Returns the bit number of the first cleared bit.
|  * If no bits are zero, returns @size.

"If no bits are zero, returns @size or a number larger than @size."

|  */
| extern unsigned long find_first_zero_bit(const unsigned long *addr,
|                                          unsigned long size);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 10:55             ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 10:55 UTC (permalink / raw)
  To: Julia Lawall
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	David Laight, Arnd Bergmann, netdev

Hi Julia,

On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> Maybe the documented return code should be changed to allow for the
>> existing behaviour.
>
> Sorry, I'm not sure to understand what you suggest here.

include/asm-generic/bitops/find.h:

| /**
|  * find_first_zero_bit - find the first cleared bit in a memory region
|  * @addr: The address to start the search at
|  * @size: The maximum number of bits to search
|  *
|  * Returns the bit number of the first cleared bit.
|  * If no bits are zero, returns @size.

"If no bits are zero, returns @size or a number larger than @size."

|  */
| extern unsigned long find_first_zero_bit(const unsigned long *addr,
|                                          unsigned long size);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 10:55             ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 10:55 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann

Hi Julia,

On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> Maybe the documented return code should be changed to allow for the
>> existing behaviour.
>
> Sorry, I'm not sure to understand what you suggest here.

include/asm-generic/bitops/find.h:

| /**
|  * find_first_zero_bit - find the first cleared bit in a memory region
|  * @addr: The address to start the search at
|  * @size: The maximum number of bits to search
|  *
|  * Returns the bit number of the first cleared bit.
|  * If no bits are zero, returns @size.

"If no bits are zero, returns @size or a number larger than @size."

|  */
| extern unsigned long find_first_zero_bit(const unsigned long *addr,
|                                          unsigned long size);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 10:55             ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 10:55 UTC (permalink / raw)
  To: Julia Lawall
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	David Laight, Arnd Bergmann, netdev

Hi Julia,

On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> Maybe the documented return code should be changed to allow for the
>> existing behaviour.
>
> Sorry, I'm not sure to understand what you suggest here.

include/asm-generic/bitops/find.h:

| /**
|  * find_first_zero_bit - find the first cleared bit in a memory region
|  * @addr: The address to start the search at
|  * @size: The maximum number of bits to search
|  *
|  * Returns the bit number of the first cleared bit.
|  * If no bits are zero, returns @size.

"If no bits are zero, returns @size or a number larger than @size."

|  */
| extern unsigned long find_first_zero_bit(const unsigned long *addr,
|                                          unsigned long size);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04 10:55             ` Geert Uytterhoeven
                                 ` (2 preceding siblings ...)
  (?)
@ 2014-06-04 11:00               ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 11:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Julia Lawall, David Laight, Arnd Bergmann, netdev



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >> Maybe the documented return code should be changed to allow for the
> >> existing behaviour.
> >
> > Sorry, I'm not sure to understand what you suggest here.
>
> include/asm-generic/bitops/find.h:
>
> | /**
> |  * find_first_zero_bit - find the first cleared bit in a memory region
> |  * @addr: The address to start the search at
> |  * @size: The maximum number of bits to search
> |  *
> |  * Returns the bit number of the first cleared bit.
> |  * If no bits are zero, returns @size.
>
> "If no bits are zero, returns @size or a number larger than @size."

OK, thanks.  I was only looking at the C code.

But the C code contains a loop that is followed by:

        if (!size)
                return result;
        tmp = *p;

found_first:
        tmp |= ~0UL << size;
        if (tmp = ~0UL)        /* Are any bits zero? */
                return result + size;   /* Nope. */

In the first return, it would seem that result = size.  Could the second
one be changed to just return size?  It should not hurt performance.

julia

>
> |  */
> | extern unsigned long find_first_zero_bit(const unsigned long *addr,
> |                                          unsigned long size);
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
>

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:00               ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 11:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >> Maybe the documented return code should be changed to allow for the
> >> existing behaviour.
> >
> > Sorry, I'm not sure to understand what you suggest here.
>
> include/asm-generic/bitops/find.h:
>
> | /**
> |  * find_first_zero_bit - find the first cleared bit in a memory region
> |  * @addr: The address to start the search at
> |  * @size: The maximum number of bits to search
> |  *
> |  * Returns the bit number of the first cleared bit.
> |  * If no bits are zero, returns @size.
>
> "If no bits are zero, returns @size or a number larger than @size."

OK, thanks.  I was only looking at the C code.

But the C code contains a loop that is followed by:

        if (!size)
                return result;
        tmp = *p;

found_first:
        tmp |= ~0UL << size;
        if (tmp == ~0UL)        /* Are any bits zero? */
                return result + size;   /* Nope. */

In the first return, it would seem that result == size.  Could the second
one be changed to just return size?  It should not hurt performance.

julia

>
> |  */
> | extern unsigned long find_first_zero_bit(const unsigned long *addr,
> |                                          unsigned long size);
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
>

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:00               ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 11:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Julia Lawall, David Laight, Arnd Bergmann, netdev



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >> Maybe the documented return code should be changed to allow for the
> >> existing behaviour.
> >
> > Sorry, I'm not sure to understand what you suggest here.
>
> include/asm-generic/bitops/find.h:
>
> | /**
> |  * find_first_zero_bit - find the first cleared bit in a memory region
> |  * @addr: The address to start the search at
> |  * @size: The maximum number of bits to search
> |  *
> |  * Returns the bit number of the first cleared bit.
> |  * If no bits are zero, returns @size.
>
> "If no bits are zero, returns @size or a number larger than @size."

OK, thanks.  I was only looking at the C code.

But the C code contains a loop that is followed by:

        if (!size)
                return result;
        tmp = *p;

found_first:
        tmp |= ~0UL << size;
        if (tmp == ~0UL)        /* Are any bits zero? */
                return result + size;   /* Nope. */

In the first return, it would seem that result == size.  Could the second
one be changed to just return size?  It should not hurt performance.

julia

>
> |  */
> | extern unsigned long find_first_zero_bit(const unsigned long *addr,
> |                                          unsigned long size);
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
>

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:00               ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 11:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >> Maybe the documented return code should be changed to allow for the
> >> existing behaviour.
> >
> > Sorry, I'm not sure to understand what you suggest here.
>
> include/asm-generic/bitops/find.h:
>
> | /**
> |  * find_first_zero_bit - find the first cleared bit in a memory region
> |  * @addr: The address to start the search at
> |  * @size: The maximum number of bits to search
> |  *
> |  * Returns the bit number of the first cleared bit.
> |  * If no bits are zero, returns @size.
>
> "If no bits are zero, returns @size or a number larger than @size."

OK, thanks.  I was only looking at the C code.

But the C code contains a loop that is followed by:

        if (!size)
                return result;
        tmp = *p;

found_first:
        tmp |= ~0UL << size;
        if (tmp == ~0UL)        /* Are any bits zero? */
                return result + size;   /* Nope. */

In the first return, it would seem that result == size.  Could the second
one be changed to just return size?  It should not hurt performance.

julia

>
> |  */
> | extern unsigned long find_first_zero_bit(const unsigned long *addr,
> |                                          unsigned long size);
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
>

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:00               ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 11:00 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Julia Lawall, David Laight, Arnd Bergmann, netdev



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 11:52 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >> Maybe the documented return code should be changed to allow for the
> >> existing behaviour.
> >
> > Sorry, I'm not sure to understand what you suggest here.
>
> include/asm-generic/bitops/find.h:
>
> | /**
> |  * find_first_zero_bit - find the first cleared bit in a memory region
> |  * @addr: The address to start the search at
> |  * @size: The maximum number of bits to search
> |  *
> |  * Returns the bit number of the first cleared bit.
> |  * If no bits are zero, returns @size.
>
> "If no bits are zero, returns @size or a number larger than @size."

OK, thanks.  I was only looking at the C code.

But the C code contains a loop that is followed by:

        if (!size)
                return result;
        tmp = *p;

found_first:
        tmp |= ~0UL << size;
        if (tmp == ~0UL)        /* Are any bits zero? */
                return result + size;   /* Nope. */

In the first return, it would seem that result == size.  Could the second
one be changed to just return size?  It should not hurt performance.

julia

>
> |  */
> | extern unsigned long find_first_zero_bit(const unsigned long *addr,
> |                                          unsigned long size);
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
>

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04 11:00               ` Julia Lawall
                                   ` (3 preceding siblings ...)
  (?)
@ 2014-06-04 11:07                 ` Geert Uytterhoeven
  -1 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 11:07 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Laight, linux-rdma, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Linux Fbdev development list, Linux-sh list,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-wireless,
	netdev-u79uwXL29TY76Z2rM5mHXA, driverdevel,
	iss_storagedev-VXdhtT5mjnY, scsi, linux-s390,
	adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Arnd Bergmann

Hi Julia,

On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> OK, thanks.  I was only looking at the C code.
>
> But the C code contains a loop that is followed by:
>
>         if (!size)
>                 return result;
>         tmp = *p;
>
> found_first:
>         tmp |= ~0UL << size;
>         if (tmp = ~0UL)        /* Are any bits zero? */
>                 return result + size;   /* Nope. */
>
> In the first return, it would seem that result = size.  Could the second
> one be changed to just return size?  It should not hurt performance.

"size" may have been changed between function entry and this line.
So you have to store it in a temporary.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:07                 ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 11:07 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann

Hi Julia,

On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> OK, thanks.  I was only looking at the C code.
>
> But the C code contains a loop that is followed by:
>
>         if (!size)
>                 return result;
>         tmp = *p;
>
> found_first:
>         tmp |= ~0UL << size;
>         if (tmp == ~0UL)        /* Are any bits zero? */
>                 return result + size;   /* Nope. */
>
> In the first return, it would seem that result == size.  Could the second
> one be changed to just return size?  It should not hurt performance.

"size" may have been changed between function entry and this line.
So you have to store it in a temporary.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:07                 ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 11:07 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Laight, linux-rdma, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Linux Fbdev development list, Linux-sh list,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-wireless,
	netdev-u79uwXL29TY76Z2rM5mHXA, driverdevel,
	iss_storagedev-VXdhtT5mjnY, scsi, linux-s390,
	adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Arnd Bergmann

Hi Julia,

On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org> wrote:
> OK, thanks.  I was only looking at the C code.
>
> But the C code contains a loop that is followed by:
>
>         if (!size)
>                 return result;
>         tmp = *p;
>
> found_first:
>         tmp |= ~0UL << size;
>         if (tmp == ~0UL)        /* Are any bits zero? */
>                 return result + size;   /* Nope. */
>
> In the first return, it would seem that result == size.  Could the second
> one be changed to just return size?  It should not hurt performance.

"size" may have been changed between function entry and this line.
So you have to store it in a temporary.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:07                 ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 11:07 UTC (permalink / raw)
  To: Julia Lawall
  Cc: David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann

Hi Julia,

On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> OK, thanks.  I was only looking at the C code.
>
> But the C code contains a loop that is followed by:
>
>         if (!size)
>                 return result;
>         tmp = *p;
>
> found_first:
>         tmp |= ~0UL << size;
>         if (tmp == ~0UL)        /* Are any bits zero? */
>                 return result + size;   /* Nope. */
>
> In the first return, it would seem that result == size.  Could the second
> one be changed to just return size?  It should not hurt performance.

"size" may have been changed between function entry and this line.
So you have to store it in a temporary.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:07                 ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 11:07 UTC (permalink / raw)
  To: Julia Lawall
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	David Laight, Arnd Bergmann, netdev

Hi Julia,

On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> OK, thanks.  I was only looking at the C code.
>
> But the C code contains a loop that is followed by:
>
>         if (!size)
>                 return result;
>         tmp = *p;
>
> found_first:
>         tmp |= ~0UL << size;
>         if (tmp == ~0UL)        /* Are any bits zero? */
>                 return result + size;   /* Nope. */
>
> In the first return, it would seem that result == size.  Could the second
> one be changed to just return size?  It should not hurt performance.

"size" may have been changed between function entry and this line.
So you have to store it in a temporary.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:07                 ` Geert Uytterhoeven
  0 siblings, 0 replies; 93+ messages in thread
From: Geert Uytterhoeven @ 2014-06-04 11:07 UTC (permalink / raw)
  To: Julia Lawall
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	David Laight, Arnd Bergmann, netdev

Hi Julia,

On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> OK, thanks.  I was only looking at the C code.
>
> But the C code contains a loop that is followed by:
>
>         if (!size)
>                 return result;
>         tmp = *p;
>
> found_first:
>         tmp |= ~0UL << size;
>         if (tmp = ~0UL)        /* Are any bits zero? */
>                 return result + size;   /* Nope. */
>
> In the first return, it would seem that result = size.  Could the second
> one be changed to just return size?  It should not hurt performance.

"size" may have been changed between function entry and this line.
So you have to store it in a temporary.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 8/10] s390/pci: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07   ` Julia Lawall
@ 2014-06-04 11:09     ` Sebastian Ott
  -1 siblings, 0 replies; 93+ messages in thread
From: Sebastian Ott @ 2014-06-04 11:09 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Gerald Schaefer, Martin Schwidefsky,
	Heiko Carstens, linux390, linux-s390, linux-kernel

On Wed, 4 Jun 2014, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e1,e2,e3;
> statement S1,S2;
> @@
> 
> e1 = find_first_zero_bit(e2,e3)
> ...
> if (e1 
> - ==
> + >=
>   e3)
> S1 else S2
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  arch/s390/pci/pci.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff -u -p a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -566,7 +566,7 @@ static int zpci_alloc_iomap(struct zpci_
> 
>  	spin_lock(&zpci_iomap_lock);
>  	entry = find_first_zero_bit(zpci_iomap, ZPCI_IOMAP_MAX_ENTRIES);
> -	if (entry == ZPCI_IOMAP_MAX_ENTRIES) {
> +	if (entry >= ZPCI_IOMAP_MAX_ENTRIES) {
>  		spin_unlock(&zpci_iomap_lock);
>  		return -ENOSPC;
>  	}
> @@ -746,7 +746,7 @@ static int zpci_alloc_domain(struct zpci
>  {
>  	spin_lock(&zpci_domain_lock);
>  	zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES);
> -	if (zdev->domain == ZPCI_NR_DEVICES) {
> +	if (zdev->domain >= ZPCI_NR_DEVICES) {
>  		spin_unlock(&zpci_domain_lock);
>  		return -ENOSPC;
>  	}
> 
> 

Thanks, applied.
Sebastian


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

* Re: [PATCH 8/10] s390/pci: use safer test on the result of find_first_zero_bit
@ 2014-06-04 11:09     ` Sebastian Ott
  0 siblings, 0 replies; 93+ messages in thread
From: Sebastian Ott @ 2014-06-04 11:09 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Gerald Schaefer, Martin Schwidefsky,
	Heiko Carstens, linux390, linux-s390, linux-kernel

On Wed, 4 Jun 2014, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e1,e2,e3;
> statement S1,S2;
> @@
> 
> e1 = find_first_zero_bit(e2,e3)
> ...
> if (e1 
> - =
> + >>   e3)
> S1 else S2
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  arch/s390/pci/pci.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff -u -p a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -566,7 +566,7 @@ static int zpci_alloc_iomap(struct zpci_
> 
>  	spin_lock(&zpci_iomap_lock);
>  	entry = find_first_zero_bit(zpci_iomap, ZPCI_IOMAP_MAX_ENTRIES);
> -	if (entry = ZPCI_IOMAP_MAX_ENTRIES) {
> +	if (entry >= ZPCI_IOMAP_MAX_ENTRIES) {
>  		spin_unlock(&zpci_iomap_lock);
>  		return -ENOSPC;
>  	}
> @@ -746,7 +746,7 @@ static int zpci_alloc_domain(struct zpci
>  {
>  	spin_lock(&zpci_domain_lock);
>  	zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES);
> -	if (zdev->domain = ZPCI_NR_DEVICES) {
> +	if (zdev->domain >= ZPCI_NR_DEVICES) {
>  		spin_unlock(&zpci_domain_lock);
>  		return -ENOSPC;
>  	}
> 
> 

Thanks, applied.
Sebastian


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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04 11:07                 ` Geert Uytterhoeven
                                     ` (2 preceding siblings ...)
  (?)
@ 2014-06-04 13:12                   ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 13:12 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann, sebott



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > OK, thanks.  I was only looking at the C code.
> >
> > But the C code contains a loop that is followed by:
> >
> >         if (!size)
> >                 return result;
> >         tmp = *p;
> >
> > found_first:
> >         tmp |= ~0UL << size;
> >         if (tmp = ~0UL)        /* Are any bits zero? */
> >                 return result + size;   /* Nope. */
> >
> > In the first return, it would seem that result = size.  Could the second
> > one be changed to just return size?  It should not hurt performance.
>
> "size" may have been changed between function entry and this line.
> So you have to store it in a temporary.

Sorry, after reflection it seems that indeed size + result is always the
original size, so it is actually all of the code that uses >= that is
doing something unnecessary.  = for the failure test is fine.

julia

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 13:12                   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 13:12 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann, sebott



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > OK, thanks.  I was only looking at the C code.
> >
> > But the C code contains a loop that is followed by:
> >
> >         if (!size)
> >                 return result;
> >         tmp = *p;
> >
> > found_first:
> >         tmp |= ~0UL << size;
> >         if (tmp == ~0UL)        /* Are any bits zero? */
> >                 return result + size;   /* Nope. */
> >
> > In the first return, it would seem that result == size.  Could the second
> > one be changed to just return size?  It should not hurt performance.
>
> "size" may have been changed between function entry and this line.
> So you have to store it in a temporary.

Sorry, after reflection it seems that indeed size + result is always the
original size, so it is actually all of the code that uses >= that is
doing something unnecessary.  == for the failure test is fine.

julia

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 13:12                   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 13:12 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, David Laight, linux-rdma, kernel-janitors,
	Linux Fbdev development list, Linux-sh list, linux-kernel,
	ath10k, linux-wireless, netdev, driverdevel, iss_storagedev,
	scsi, linux-s390, adi-buildroot-devel, Arnd Bergmann, sebott



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > OK, thanks.  I was only looking at the C code.
> >
> > But the C code contains a loop that is followed by:
> >
> >         if (!size)
> >                 return result;
> >         tmp = *p;
> >
> > found_first:
> >         tmp |= ~0UL << size;
> >         if (tmp == ~0UL)        /* Are any bits zero? */
> >                 return result + size;   /* Nope. */
> >
> > In the first return, it would seem that result == size.  Could the second
> > one be changed to just return size?  It should not hurt performance.
>
> "size" may have been changed between function entry and this line.
> So you have to store it in a temporary.

Sorry, after reflection it seems that indeed size + result is always the
original size, so it is actually all of the code that uses >= that is
doing something unnecessary.  == for the failure test is fine.

julia

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 13:12                   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 13:12 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Julia Lawall, David Laight, Arnd Bergmann, netdev, sebott



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > OK, thanks.  I was only looking at the C code.
> >
> > But the C code contains a loop that is followed by:
> >
> >         if (!size)
> >                 return result;
> >         tmp = *p;
> >
> > found_first:
> >         tmp |= ~0UL << size;
> >         if (tmp == ~0UL)        /* Are any bits zero? */
> >                 return result + size;   /* Nope. */
> >
> > In the first return, it would seem that result == size.  Could the second
> > one be changed to just return size?  It should not hurt performance.
>
> "size" may have been changed between function entry and this line.
> So you have to store it in a temporary.

Sorry, after reflection it seems that indeed size + result is always the
original size, so it is actually all of the code that uses >= that is
doing something unnecessary.  == for the failure test is fine.

julia

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 13:12                   ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 13:12 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Julia Lawall, David Laight, Arnd Bergmann, netdev, sebott



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > OK, thanks.  I was only looking at the C code.
> >
> > But the C code contains a loop that is followed by:
> >
> >         if (!size)
> >                 return result;
> >         tmp = *p;
> >
> > found_first:
> >         tmp |= ~0UL << size;
> >         if (tmp = ~0UL)        /* Are any bits zero? */
> >                 return result + size;   /* Nope. */
> >
> > In the first return, it would seem that result = size.  Could the second
> > one be changed to just return size?  It should not hurt performance.
>
> "size" may have been changed between function entry and this line.
> So you have to store it in a temporary.

Sorry, after reflection it seems that indeed size + result is always the
original size, so it is actually all of the code that uses >= that is
doing something unnecessary.  = for the failure test is fine.

julia

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
  2014-06-04 13:12                   ` Julia Lawall
                                       ` (2 preceding siblings ...)
  (?)
@ 2014-06-04 13:34                     ` David Laight
  -1 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04 13:34 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: linux-rdma, kernel-janitors, Linux Fbdev development list,
	Linux-sh list, linux-kernel, ath10k, linux-wireless, netdev,
	driverdevel, iss_storagedev, scsi, linux-s390,
	adi-buildroot-devel, Arnd Bergmann, sebott

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > > OK, thanks.  I was only looking at the C code.
> > >
> > > But the C code contains a loop that is followed by:
> > >
> > >         if (!size)
> > >                 return result;
> > >         tmp = *p;
> > >
> > > found_first:
> > >         tmp |= ~0UL << size;
> > >         if (tmp = ~0UL)        /* Are any bits zero? */
> > >                 return result + size;   /* Nope. */
> > >
> > > In the first return, it would seem that result = size.  Could the second
> > > one be changed to just return size?  It should not hurt performance.
> >
> > "size" may have been changed between function entry and this line.
> > So you have to store it in a temporary.
> 
> Sorry, after reflection it seems that indeed size + result is always the
> original size, so it is actually all of the code that uses >= that is
> doing something unnecessary.  = for the failure test is fine.

There is nothing wrong with defensive coding.
The 'tmp |= ~0UL << size' ensures that the return value is 'correct'
when there are no bits set.
The function could have been defined so that this wasn't needed.

If you assume that the 'no zero bits' is unlikely, then checking the
return value from ffz() could well be slightly faster.
Not that anything is likely to notice.

	David




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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 13:34                     ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04 13:34 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: linux-rdma, kernel-janitors, Linux Fbdev development list,
	Linux-sh list, linux-kernel, ath10k, linux-wireless, netdev,
	driverdevel, iss_storagedev, scsi, linux-s390,
	adi-buildroot-devel, Arnd Bergmann, sebott

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > > OK, thanks.  I was only looking at the C code.
> > >
> > > But the C code contains a loop that is followed by:
> > >
> > >         if (!size)
> > >                 return result;
> > >         tmp = *p;
> > >
> > > found_first:
> > >         tmp |= ~0UL << size;
> > >         if (tmp == ~0UL)        /* Are any bits zero? */
> > >                 return result + size;   /* Nope. */
> > >
> > > In the first return, it would seem that result == size.  Could the second
> > > one be changed to just return size?  It should not hurt performance.
> >
> > "size" may have been changed between function entry and this line.
> > So you have to store it in a temporary.
> 
> Sorry, after reflection it seems that indeed size + result is always the
> original size, so it is actually all of the code that uses >= that is
> doing something unnecessary.  == for the failure test is fine.

There is nothing wrong with defensive coding.
The 'tmp |= ~0UL << size' ensures that the return value is 'correct'
when there are no bits set.
The function could have been defined so that this wasn't needed.

If you assume that the 'no zero bits' is unlikely, then checking the
return value from ffz() could well be slightly faster.
Not that anything is likely to notice.

	David




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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 13:34                     ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04 13:34 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: linux-rdma, kernel-janitors, Linux Fbdev development list,
	Linux-sh list, linux-kernel, ath10k, linux-wireless, netdev,
	driverdevel, iss_storagedev, scsi, linux-s390,
	adi-buildroot-devel, Arnd Bergmann, sebott

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > > OK, thanks.  I was only looking at the C code.
> > >
> > > But the C code contains a loop that is followed by:
> > >
> > >         if (!size)
> > >                 return result;
> > >         tmp = *p;
> > >
> > > found_first:
> > >         tmp |= ~0UL << size;
> > >         if (tmp == ~0UL)        /* Are any bits zero? */
> > >                 return result + size;   /* Nope. */
> > >
> > > In the first return, it would seem that result == size.  Could the second
> > > one be changed to just return size?  It should not hurt performance.
> >
> > "size" may have been changed between function entry and this line.
> > So you have to store it in a temporary.
> 
> Sorry, after reflection it seems that indeed size + result is always the
> original size, so it is actually all of the code that uses >= that is
> doing something unnecessary.  == for the failure test is fine.

There is nothing wrong with defensive coding.
The 'tmp |= ~0UL << size' ensures that the return value is 'correct'
when there are no bits set.
The function could have been defined so that this wasn't needed.

If you assume that the 'no zero bits' is unlikely, then checking the
return value from ffz() could well be slightly faster.
Not that anything is likely to notice.

	David




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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 13:34                     ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04 13:34 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Arnd Bergmann, netdev, sebott

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > > OK, thanks.  I was only looking at the C code.
> > >
> > > But the C code contains a loop that is followed by:
> > >
> > >         if (!size)
> > >                 return result;
> > >         tmp = *p;
> > >
> > > found_first:
> > >         tmp |= ~0UL << size;
> > >         if (tmp == ~0UL)        /* Are any bits zero? */
> > >                 return result + size;   /* Nope. */
> > >
> > > In the first return, it would seem that result == size.  Could the second
> > > one be changed to just return size?  It should not hurt performance.
> >
> > "size" may have been changed between function entry and this line.
> > So you have to store it in a temporary.
> 
> Sorry, after reflection it seems that indeed size + result is always the
> original size, so it is actually all of the code that uses >= that is
> doing something unnecessary.  == for the failure test is fine.

There is nothing wrong with defensive coding.
The 'tmp |= ~0UL << size' ensures that the return value is 'correct'
when there are no bits set.
The function could have been defined so that this wasn't needed.

If you assume that the 'no zero bits' is unlikely, then checking the
return value from ffz() could well be slightly faster.
Not that anything is likely to notice.

	David




_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

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

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
@ 2014-06-04 13:34                     ` David Laight
  0 siblings, 0 replies; 93+ messages in thread
From: David Laight @ 2014-06-04 13:34 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: driverdevel, linux-s390, Linux Fbdev development list, scsi,
	iss_storagedev, Linux-sh list, linux-rdma, linux-wireless,
	kernel-janitors, linux-kernel, ath10k, adi-buildroot-devel,
	Arnd Bergmann, netdev, sebott

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > > OK, thanks.  I was only looking at the C code.
> > >
> > > But the C code contains a loop that is followed by:
> > >
> > >         if (!size)
> > >                 return result;
> > >         tmp = *p;
> > >
> > > found_first:
> > >         tmp |= ~0UL << size;
> > >         if (tmp = ~0UL)        /* Are any bits zero? */
> > >                 return result + size;   /* Nope. */
> > >
> > > In the first return, it would seem that result = size.  Could the second
> > > one be changed to just return size?  It should not hurt performance.
> >
> > "size" may have been changed between function entry and this line.
> > So you have to store it in a temporary.
> 
> Sorry, after reflection it seems that indeed size + result is always the
> original size, so it is actually all of the code that uses >= that is
> doing something unnecessary.  = for the failure test is fine.

There is nothing wrong with defensive coding.
The 'tmp |= ~0UL << size' ensures that the return value is 'correct'
when there are no bits set.
The function could have been defined so that this wasn't needed.

If you assume that the 'no zero bits' is unlikely, then checking the
return value from ffz() could well be slightly faster.
Not that anything is likely to notice.

	David




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

* Re: [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07   ` Julia Lawall
@ 2014-06-04 14:54     ` scameron
  -1 siblings, 0 replies; 93+ messages in thread
From: scameron @ 2014-06-04 14:54 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, James E.J. Bottomley, iss_storagedev,
	linux-scsi, linux-kernel, scameron

On Wed, Jun 04, 2014 at 11:07:56AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e1,e2,e3;
> statement S1,S2;
> @@
> 
> e1 = find_first_zero_bit(e2,e3)
> ...
> if (e1 
> - ==
> + >=
>   e3)
> S1 else S2
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/scsi/hpsa.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
>  	spin_lock_irqsave(&h->lock, flags);
>  	do {
>  		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> -		if (i == h->nr_cmds) {
> +		if (i >= h->nr_cmds) {
>  			spin_unlock_irqrestore(&h->lock, flags);
>  			return NULL;
>  		}

Thanks, Ack.

You can add

Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>

to this patch if you want.

You might also consider adding "Cc: stable@vger.kernel.org" to the sign-off area.

-- steve


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

* Re: [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
@ 2014-06-04 14:54     ` scameron
  0 siblings, 0 replies; 93+ messages in thread
From: scameron @ 2014-06-04 14:54 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, James E.J. Bottomley, iss_storagedev,
	linux-scsi, linux-kernel, scameron

On Wed, Jun 04, 2014 at 11:07:56AM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e1,e2,e3;
> statement S1,S2;
> @@
> 
> e1 = find_first_zero_bit(e2,e3)
> ...
> if (e1 
> - =
> + >>   e3)
> S1 else S2
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/scsi/hpsa.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
>  	spin_lock_irqsave(&h->lock, flags);
>  	do {
>  		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> -		if (i = h->nr_cmds) {
> +		if (i >= h->nr_cmds) {
>  			spin_unlock_irqrestore(&h->lock, flags);
>  			return NULL;
>  		}

Thanks, Ack.

You can add

Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>

to this patch if you want.

You might also consider adding "Cc: stable@vger.kernel.org" to the sign-off area.

-- steve


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

* Re: [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
  2014-06-04 14:54     ` scameron
@ 2014-06-04 15:06       ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 15:06 UTC (permalink / raw)
  To: scameron
  Cc: Julia Lawall, kernel-janitors, James E.J. Bottomley,
	iss_storagedev, linux-scsi, linux-kernel



On Wed, 4 Jun 2014, scameron@beardog.cce.hp.com wrote:

> On Wed, Jun 04, 2014 at 11:07:56AM +0200, Julia Lawall wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
> >
> > The semantic match that finds this problem is as follows:
> > (http://coccinelle.lip6.fr/)
> >
> > // <smpl>
> > @@
> > expression e1,e2,e3;
> > statement S1,S2;
> > @@
> >
> > e1 = find_first_zero_bit(e2,e3)
> > ...
> > if (e1
> > - ==
> > + >=
> >   e3)
> > S1 else S2
> > // </smpl>
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > ---
> >  drivers/scsi/hpsa.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> > --- a/drivers/scsi/hpsa.c
> > +++ b/drivers/scsi/hpsa.c
> > @@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
> >  	spin_lock_irqsave(&h->lock, flags);
> >  	do {
> >  		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> > -		if (i == h->nr_cmds) {
> > +		if (i >= h->nr_cmds) {
> >  			spin_unlock_irqrestore(&h->lock, flags);
> >  			return NULL;
> >  		}
>
> Thanks, Ack.
>
> You can add
>
> Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
>
> to this patch if you want.
>
> You might also consider adding "Cc: stable@vger.kernel.org" to the sign-off area.

Actually, it seems that the function can never overshoot the specified
limit.  So the change is not needed.

julia

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

* Re: [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
@ 2014-06-04 15:06       ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 15:06 UTC (permalink / raw)
  To: scameron
  Cc: Julia Lawall, kernel-janitors, James E.J. Bottomley,
	iss_storagedev, linux-scsi, linux-kernel



On Wed, 4 Jun 2014, scameron@beardog.cce.hp.com wrote:

> On Wed, Jun 04, 2014 at 11:07:56AM +0200, Julia Lawall wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
> >
> > The semantic match that finds this problem is as follows:
> > (http://coccinelle.lip6.fr/)
> >
> > // <smpl>
> > @@
> > expression e1,e2,e3;
> > statement S1,S2;
> > @@
> >
> > e1 = find_first_zero_bit(e2,e3)
> > ...
> > if (e1
> > - =
> > + >> >   e3)
> > S1 else S2
> > // </smpl>
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > ---
> >  drivers/scsi/hpsa.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> > --- a/drivers/scsi/hpsa.c
> > +++ b/drivers/scsi/hpsa.c
> > @@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
> >  	spin_lock_irqsave(&h->lock, flags);
> >  	do {
> >  		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> > -		if (i = h->nr_cmds) {
> > +		if (i >= h->nr_cmds) {
> >  			spin_unlock_irqrestore(&h->lock, flags);
> >  			return NULL;
> >  		}
>
> Thanks, Ack.
>
> You can add
>
> Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
>
> to this patch if you want.
>
> You might also consider adding "Cc: stable@vger.kernel.org" to the sign-off area.

Actually, it seems that the function can never overshoot the specified
limit.  So the change is not needed.

julia

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

* Re: [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
  2014-06-04 15:06       ` Julia Lawall
@ 2014-06-04 15:14         ` scameron
  -1 siblings, 0 replies; 93+ messages in thread
From: scameron @ 2014-06-04 15:14 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, James E.J. Bottomley, iss_storagedev,
	linux-scsi, linux-kernel, scameron

On Wed, Jun 04, 2014 at 05:06:44PM +0200, Julia Lawall wrote:
> 
> 
> On Wed, 4 Jun 2014, scameron@beardog.cce.hp.com wrote:
> 
> > On Wed, Jun 04, 2014 at 11:07:56AM +0200, Julia Lawall wrote:
> > > From: Julia Lawall <Julia.Lawall@lip6.fr>
> > >
> > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > return a larger number than the maximum position argument if that position
> > > is not a multiple of BITS_PER_LONG.
> > >
> > > The semantic match that finds this problem is as follows:
> > > (http://coccinelle.lip6.fr/)
> > >
> > > // <smpl>
> > > @@
> > > expression e1,e2,e3;
> > > statement S1,S2;
> > > @@
> > >
> > > e1 = find_first_zero_bit(e2,e3)
> > > ...
> > > if (e1
> > > - ==
> > > + >=
> > >   e3)
> > > S1 else S2
> > > // </smpl>
> > >
> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > >
> > > ---
> > >  drivers/scsi/hpsa.c |    2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> > > --- a/drivers/scsi/hpsa.c
> > > +++ b/drivers/scsi/hpsa.c
> > > @@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
> > >  	spin_lock_irqsave(&h->lock, flags);
> > >  	do {
> > >  		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> > > -		if (i == h->nr_cmds) {
> > > +		if (i >= h->nr_cmds) {
> > >  			spin_unlock_irqrestore(&h->lock, flags);
> > >  			return NULL;
> > >  		}
> >
> > Thanks, Ack.
> >
> > You can add
> >
> > Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> >
> > to this patch if you want.
> >
> > You might also consider adding "Cc: stable@vger.kernel.org" to the sign-off area.
> 
> Actually, it seems that the function can never overshoot the specified
> limit.  So the change is not needed.

Well, that would explain why nobody has complained about it in all these years.
I figured that must have been the case at least on x86, but I thought maybe
other archictectures might behave differently, and the change seemed harmless
in any case. 

-- steve



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

* Re: [PATCH 6/10] hpsa: use safer test on the result of find_first_zero_bit
@ 2014-06-04 15:14         ` scameron
  0 siblings, 0 replies; 93+ messages in thread
From: scameron @ 2014-06-04 15:14 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, James E.J. Bottomley, iss_storagedev,
	linux-scsi, linux-kernel, scameron

On Wed, Jun 04, 2014 at 05:06:44PM +0200, Julia Lawall wrote:
> 
> 
> On Wed, 4 Jun 2014, scameron@beardog.cce.hp.com wrote:
> 
> > On Wed, Jun 04, 2014 at 11:07:56AM +0200, Julia Lawall wrote:
> > > From: Julia Lawall <Julia.Lawall@lip6.fr>
> > >
> > > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > > return a larger number than the maximum position argument if that position
> > > is not a multiple of BITS_PER_LONG.
> > >
> > > The semantic match that finds this problem is as follows:
> > > (http://coccinelle.lip6.fr/)
> > >
> > > // <smpl>
> > > @@
> > > expression e1,e2,e3;
> > > statement S1,S2;
> > > @@
> > >
> > > e1 = find_first_zero_bit(e2,e3)
> > > ...
> > > if (e1
> > > - =
> > > + >> > >   e3)
> > > S1 else S2
> > > // </smpl>
> > >
> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > >
> > > ---
> > >  drivers/scsi/hpsa.c |    2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff -u -p a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> > > --- a/drivers/scsi/hpsa.c
> > > +++ b/drivers/scsi/hpsa.c
> > > @@ -4703,7 +4703,7 @@ static struct CommandList *cmd_alloc(str
> > >  	spin_lock_irqsave(&h->lock, flags);
> > >  	do {
> > >  		i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
> > > -		if (i = h->nr_cmds) {
> > > +		if (i >= h->nr_cmds) {
> > >  			spin_unlock_irqrestore(&h->lock, flags);
> > >  			return NULL;
> > >  		}
> >
> > Thanks, Ack.
> >
> > You can add
> >
> > Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> >
> > to this patch if you want.
> >
> > You might also consider adding "Cc: stable@vger.kernel.org" to the sign-off area.
> 
> Actually, it seems that the function can never overshoot the specified
> limit.  So the change is not needed.

Well, that would explain why nobody has complained about it in all these years.
I figured that must have been the case at least on x86, but I thought maybe
other archictectures might behave differently, and the change seemed harmless
in any case. 

-- steve



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

* RE: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07   ` Julia Lawall
@ 2014-06-04 18:41     ` Marciniszyn, Mike
  -1 siblings, 0 replies; 93+ messages in thread
From: Marciniszyn, Mike @ 2014-06-04 18:41 UTC (permalink / raw)
  To: Julia Lawall, infinipath
  Cc: kernel-janitors, Roland Dreier, Hefty, Sean, Hal Rosenstock,
	linux-rdma, linux-kernel

> Subject: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>

Thanks for the patch!

Roland, I'm marking this as stable since a memory corruption can occur in the _set_bit().

Cc: <stable@vger.kernel.org>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>

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

* RE: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
@ 2014-06-04 18:41     ` Marciniszyn, Mike
  0 siblings, 0 replies; 93+ messages in thread
From: Marciniszyn, Mike @ 2014-06-04 18:41 UTC (permalink / raw)
  To: Julia Lawall, infinipath
  Cc: kernel-janitors, Roland Dreier, Hefty, Sean, Hal Rosenstock,
	linux-rdma, linux-kernel

> Subject: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>

Thanks for the patch!

Roland, I'm marking this as stable since a memory corruption can occur in the _set_bit().

Cc: <stable@vger.kernel.org>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>

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

* RE: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
  2014-06-04 18:41     ` Marciniszyn, Mike
  (?)
@ 2014-06-04 19:19         ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 19:19 UTC (permalink / raw)
  To: Marciniszyn, Mike
  Cc: Julia Lawall, infinipath, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Roland Dreier, Hefty, Sean, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, 4 Jun 2014, Marciniszyn, Mike wrote:

> > Subject: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
> > 
> > From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
> 
> Thanks for the patch!
> 
> Roland, I'm marking this as stable since a memory corruption can occur in the _set_bit().

No, it's not necessary.  It turns out that the result cannot be greater 
than the requested maximum value.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
@ 2014-06-04 19:19         ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 19:19 UTC (permalink / raw)
  To: Marciniszyn, Mike
  Cc: Julia Lawall, infinipath, kernel-janitors, Roland Dreier, Hefty,
	Sean, Hal Rosenstock, linux-rdma, linux-kernel

On Wed, 4 Jun 2014, Marciniszyn, Mike wrote:

> > Subject: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
> > 
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Thanks for the patch!
> 
> Roland, I'm marking this as stable since a memory corruption can occur in the _set_bit().

No, it's not necessary.  It turns out that the result cannot be greater 
than the requested maximum value.

julia

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

* RE: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
@ 2014-06-04 19:19         ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-04 19:19 UTC (permalink / raw)
  To: Marciniszyn, Mike
  Cc: Julia Lawall, infinipath, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Roland Dreier, Hefty, Sean, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, 4 Jun 2014, Marciniszyn, Mike wrote:

> > Subject: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
> > 
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Thanks for the patch!
> 
> Roland, I'm marking this as stable since a memory corruption can occur in the _set_bit().

No, it's not necessary.  It turns out that the result cannot be greater 
than the requested maximum value.

julia

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

* RE: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
  2014-06-04 19:19         ` Julia Lawall
  (?)
@ 2014-06-04 20:03             ` Marciniszyn, Mike
  -1 siblings, 0 replies; 93+ messages in thread
From: Marciniszyn, Mike @ 2014-06-04 20:03 UTC (permalink / raw)
  To: Julia Lawall
  Cc: infinipath, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Roland Dreier, Hefty, Sean, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

> 
> No, it's not necessary.  It turns out that the result cannot be greater than the
> requested maximum value.
> 
> Julia

Ok. 

No stable then.

Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
@ 2014-06-04 20:03             ` Marciniszyn, Mike
  0 siblings, 0 replies; 93+ messages in thread
From: Marciniszyn, Mike @ 2014-06-04 20:03 UTC (permalink / raw)
  To: Julia Lawall
  Cc: infinipath, kernel-janitors, Roland Dreier, Hefty, Sean,
	Hal Rosenstock, linux-rdma, linux-kernel

> 
> No, it's not necessary.  It turns out that the result cannot be greater than the
> requested maximum value.
> 
> Julia

Ok. 

No stable then.

Mike

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

* RE: [PATCH 9/10] IB/qib: use safer test on the result of find_first_zero_bit
@ 2014-06-04 20:03             ` Marciniszyn, Mike
  0 siblings, 0 replies; 93+ messages in thread
From: Marciniszyn, Mike @ 2014-06-04 20:03 UTC (permalink / raw)
  To: Julia Lawall
  Cc: infinipath, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Roland Dreier, Hefty, Sean, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

> 
> No, it's not necessary.  It turns out that the result cannot be greater than the
> requested maximum value.
> 
> Julia

Ok. 

No stable then.

Mike

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

* Re: [PATCH 3/10] video: use safer test on the result of find_first_zero_bit
  2014-06-04  9:07   ` Julia Lawall
@ 2014-06-23 11:50     ` Tomi Valkeinen
  -1 siblings, 0 replies; 93+ messages in thread
From: Tomi Valkeinen @ 2014-06-23 11:50 UTC (permalink / raw)
  To: Julia Lawall, Jean-Christophe Plagniol-Villard
  Cc: kernel-janitors, linux-fbdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

On 04/06/14 12:07, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.

Thanks, queued for 3.17.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 3/10] video: use safer test on the result of find_first_zero_bit
@ 2014-06-23 11:50     ` Tomi Valkeinen
  0 siblings, 0 replies; 93+ messages in thread
From: Tomi Valkeinen @ 2014-06-23 11:50 UTC (permalink / raw)
  To: Julia Lawall, Jean-Christophe Plagniol-Villard
  Cc: kernel-janitors, linux-fbdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

On 04/06/14 12:07, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> return a larger number than the maximum position argument if that position
> is not a multiple of BITS_PER_LONG.

Thanks, queued for 3.17.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 3/10] video: use safer test on the result of find_first_zero_bit
  2014-06-23 11:50     ` Tomi Valkeinen
@ 2014-06-23 14:12       ` Julia Lawall
  -1 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-23 14:12 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Julia Lawall, Jean-Christophe Plagniol-Villard, kernel-janitors,
	linux-fbdev, linux-kernel

On Mon, 23 Jun 2014, Tomi Valkeinen wrote:

> On 04/06/14 12:07, Julia Lawall wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
>
> Thanks, queued for 3.17.

No, sorry you can drop it.  It doesn't hurt anything, but it is not
necessary either.  Returning a larger number is actually not possible.

julia

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

* Re: [PATCH 3/10] video: use safer test on the result of find_first_zero_bit
@ 2014-06-23 14:12       ` Julia Lawall
  0 siblings, 0 replies; 93+ messages in thread
From: Julia Lawall @ 2014-06-23 14:12 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Julia Lawall, Jean-Christophe Plagniol-Villard, kernel-janitors,
	linux-fbdev, linux-kernel

On Mon, 23 Jun 2014, Tomi Valkeinen wrote:

> On 04/06/14 12:07, Julia Lawall wrote:
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
> > return a larger number than the maximum position argument if that position
> > is not a multiple of BITS_PER_LONG.
>
> Thanks, queued for 3.17.

No, sorry you can drop it.  It doesn't hurt anything, but it is not
necessary either.  Returning a larger number is actually not possible.

julia

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

* Re: [PATCH 3/10] video: use safer test on the result of find_first_zero_bit
  2014-06-23 14:12       ` Julia Lawall
@ 2014-06-24  7:56         ` Tomi Valkeinen
  -1 siblings, 0 replies; 93+ messages in thread
From: Tomi Valkeinen @ 2014-06-24  7:56 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Jean-Christophe Plagniol-Villard, kernel-janitors, linux-fbdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

On 23/06/14 17:12, Julia Lawall wrote:
> On Mon, 23 Jun 2014, Tomi Valkeinen wrote:
> 
>> On 04/06/14 12:07, Julia Lawall wrote:
>>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>>>
>>> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
>>> return a larger number than the maximum position argument if that position
>>> is not a multiple of BITS_PER_LONG.
>>
>> Thanks, queued for 3.17.
> 
> No, sorry you can drop it.  It doesn't hurt anything, but it is not
> necessary either.  Returning a larger number is actually not possible.

Ok, dropped.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 3/10] video: use safer test on the result of find_first_zero_bit
@ 2014-06-24  7:56         ` Tomi Valkeinen
  0 siblings, 0 replies; 93+ messages in thread
From: Tomi Valkeinen @ 2014-06-24  7:56 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Jean-Christophe Plagniol-Villard, kernel-janitors, linux-fbdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

On 23/06/14 17:12, Julia Lawall wrote:
> On Mon, 23 Jun 2014, Tomi Valkeinen wrote:
> 
>> On 04/06/14 12:07, Julia Lawall wrote:
>>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>>>
>>> Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
>>> return a larger number than the maximum position argument if that position
>>> is not a multiple of BITS_PER_LONG.
>>
>> Thanks, queued for 3.17.
> 
> No, sorry you can drop it.  It doesn't hurt anything, but it is not
> necessary either.  Returning a larger number is actually not possible.

Ok, dropped.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-06-24  7:56 UTC | newest]

Thread overview: 93+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-04  9:07 [PATCH 0/10] use safer test on the result of find_first_zero_bit Julia Lawall
2014-06-04  9:07 ` Julia Lawall
2014-06-04  9:07 ` Julia Lawall
2014-06-04  9:07 ` Julia Lawall
2014-06-04  9:07 ` [PATCH 1/10] sh: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 2/10] ath10k: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 3/10] video: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-23 11:50   ` Tomi Valkeinen
2014-06-23 11:50     ` Tomi Valkeinen
2014-06-23 14:12     ` Julia Lawall
2014-06-23 14:12       ` Julia Lawall
2014-06-24  7:56       ` Tomi Valkeinen
2014-06-24  7:56         ` Tomi Valkeinen
2014-06-04  9:07 ` [PATCH 4/10] staging: tidspbridge: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 5/10] ARC: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 6/10] hpsa: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04 14:54   ` scameron
2014-06-04 14:54     ` scameron
2014-06-04 15:06     ` Julia Lawall
2014-06-04 15:06       ` Julia Lawall
2014-06-04 15:14       ` scameron
2014-06-04 15:14         ` scameron
2014-06-04  9:07 ` [PATCH 7/10] cciss: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04  9:07 ` [PATCH 8/10] s390/pci: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04 11:09   ` Sebastian Ott
2014-06-04 11:09     ` Sebastian Ott
2014-06-04  9:07 ` [PATCH 9/10] IB/qib: " Julia Lawall
2014-06-04  9:07   ` Julia Lawall
2014-06-04 18:41   ` Marciniszyn, Mike
2014-06-04 18:41     ` Marciniszyn, Mike
     [not found]     ` <32E1700B9017364D9B60AED9960492BC21BE92E6-RjuIdWtd+YbTXloPLtfHfbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-06-04 19:19       ` Julia Lawall
2014-06-04 19:19         ` Julia Lawall
2014-06-04 19:19         ` Julia Lawall
     [not found]         ` <alpine.DEB.2.02.1406042118420.1977-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2014-06-04 20:03           ` Marciniszyn, Mike
2014-06-04 20:03             ` Marciniszyn, Mike
2014-06-04 20:03             ` Marciniszyn, Mike
2014-06-04  9:08 ` [PATCH 10/10] blackfin: " Julia Lawall
2014-06-04  9:08   ` Julia Lawall
2014-06-04  9:35 ` [PATCH 0/10] " Geert Uytterhoeven
2014-06-04  9:35   ` Geert Uytterhoeven
2014-06-04  9:35   ` Geert Uytterhoeven
2014-06-04  9:35   ` Geert Uytterhoeven
     [not found]   ` <CAMuHMdXsoFUXj4jLMWN6NY7Um19KwWO9Rhx=9=gqWu_K5Ev2kQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-04  9:38     ` Julia Lawall
2014-06-04  9:38       ` Julia Lawall
2014-06-04  9:38       ` Julia Lawall
2014-06-04  9:38       ` Julia Lawall
2014-06-04  9:38       ` Julia Lawall
2014-06-04  9:46       ` David Laight
2014-06-04  9:46         ` David Laight
2014-06-04  9:46         ` David Laight
2014-06-04  9:46         ` David Laight
2014-06-04  9:46         ` David Laight
2014-06-04  9:46         ` David Laight
2014-06-04  9:52         ` Julia Lawall
2014-06-04  9:52           ` Julia Lawall
2014-06-04  9:52           ` Julia Lawall
2014-06-04  9:52           ` Julia Lawall
2014-06-04  9:52           ` Julia Lawall
2014-06-04 10:55           ` Geert Uytterhoeven
2014-06-04 10:55             ` Geert Uytterhoeven
2014-06-04 10:55             ` Geert Uytterhoeven
2014-06-04 10:55             ` Geert Uytterhoeven
2014-06-04 10:55             ` Geert Uytterhoeven
2014-06-04 11:00             ` Julia Lawall
2014-06-04 11:00               ` Julia Lawall
2014-06-04 11:00               ` Julia Lawall
2014-06-04 11:00               ` Julia Lawall
2014-06-04 11:00               ` Julia Lawall
2014-06-04 11:07               ` Geert Uytterhoeven
2014-06-04 11:07                 ` Geert Uytterhoeven
2014-06-04 11:07                 ` Geert Uytterhoeven
2014-06-04 11:07                 ` Geert Uytterhoeven
2014-06-04 11:07                 ` Geert Uytterhoeven
2014-06-04 11:07                 ` Geert Uytterhoeven
2014-06-04 13:12                 ` Julia Lawall
2014-06-04 13:12                   ` Julia Lawall
2014-06-04 13:12                   ` Julia Lawall
2014-06-04 13:12                   ` Julia Lawall
2014-06-04 13:12                   ` Julia Lawall
2014-06-04 13:34                   ` David Laight
2014-06-04 13:34                     ` David Laight
2014-06-04 13:34                     ` David Laight
2014-06-04 13:34                     ` David Laight
2014-06-04 13:34                     ` David Laight

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.