Skip to contentSkip to conversation

coccicheck: Fix missing 0 index in kill loop

PATCH In review Kees Cook 4 participants 4 messages May 16, 2016 – May 19, 2016 Coccinelle/Semantic Patches (SmPL)

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 coccicheck: Fix missing 0 index in kill loop

By default, "seq" counts from 1, but processes were starting counting from 0, so when interrupted, coccicheck would leave the 0th process running.

---
 scripts/coccicheck | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +1 -1
index b2d758188f2f..dd85a455b2ba 100755
@@ -98,7 +98,7 @@ run_cmd() {
 }
 
 kill_running() {
-	for i in $(seq $(( NPROC - 1 )) ); do
+	for i in $(seq 0 $(( NPROC - 1 )) ); do
 		if [ $VERBOSE -eq 2 ] ; then
 			echo "Killing ${SPATCH_PID[$i]}"
 		fi
Signature · 6 lines
2.6.3


-- 
Kees Cook
Chrome OS & Brillo Security
maintainer Acked-by on v1 1/1
#1 lore raw

Le 16/05/16 14:55, Kees Cook a ?crit :

Quoted 5 lines

By default, "seq" counts from 1, but processes were starting counting from 0, so when interrupted, coccicheck would leave the 0th process running.

Quoted 18 lines
---
 scripts/coccicheck | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +1 -1
index b2d758188f2f..dd85a455b2ba 100755
@@ -98,7 +98,7 @@ run_cmd() {
 }
 
 kill_running() {
-	for i in $(seq $(( NPROC - 1 )) ); do
+	for i in $(seq 0 $(( NPROC - 1 )) ); do
 		if [ $VERBOSE -eq 2 ] ; then
 			echo "Killing ${SPATCH_PID[$i]}"
 		fi
Signature · 10 lines
Nicolas Palix
http://lig-membres.imag.fr/palix/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2959 bytes
Desc: Signature cryptographique S/MIME
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20160517/5fcdf348/attachment.p7s>
Acked-by
#2 lore raw
Quoted 8 lines · Nicolas Palix (LIG)

Le 16/05/16 14:55, Kees Cook a ?crit :

Quoted 5 lines

By default, "seq" counts from 1, but processes were starting counting from 0, so when interrupted, coccicheck would leave the 0th process running.

Quoted 27 lines
Quoted 12 lines

---
 scripts/coccicheck | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +0 -0
index b2d758188f2f..dd85a455b2ba 100755

scripts/coccicheck run_cmd() { · line 104

Quoted 8 lines
scripts/coccicheck +1 -1
@@ -98,7 +98,7 @@ run_cmd() {
 }
 
 kill_running() {
-	for i in $(seq $(( NPROC - 1 )) ); do
+	for i in $(seq 0 $(( NPROC - 1 )) ); do
 		if [ $VERBOSE -eq 2 ] ; then
 			echo "Killing ${SPATCH_PID[$i]}"
 		fi

--
Nicolas Palix
http://lig-membres.imag.fr/palix/

#3 lore raw

Dne 17.5.2016 v 16:33 Julia Lawall napsal(a):

Quoted 9 lines · Nicolas Palix (LIG)
Quoted 6 lines

Le 16/05/16 14:55, Kees Cook a ?crit :

Quoted 4 lines

By default, "seq" counts from 1, but processes were starting counting from 0, so when interrupted, coccicheck would leave the 0th process running.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applied to kbuild.git#misc.

Michal