lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 14 Jun 2017 13:29:51 +0200
From:   Jesper Dangaard Brouer <brouer@...hat.com>
To:     Tariq Toukan <tariqt@...lanox.com>
Cc:     "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        Eran Ben Elisha <eranbe@...lanox.com>, brouer@...hat.com
Subject: Re: [PATCH net-next 2/2] pktgen: Specify the index of first thread

On Wed, 14 Jun 2017 14:10:37 +0300
Tariq Toukan <tariqt@...lanox.com> wrote:

> >> +export L_THREAD="$THREADS + $F_THREAD - 1"
> >> +  
> > 
> > This is sort of bad-shell coding.  This will first get expanded at the
> > usage point.  The way you use it, it will work, because of the for loop
> > uses an expansion like "((xxx))".
> > 
> > If you echo the $L_THREAD variable you will see: "1 + 0 - 1"
> > 
> > IMHO the right thing is to use:
> > 
> >    export L_THREAD=$(( THREADS + F_THREAD - 1 ))
> > 
> > (I tested this also works for dash + ksh + zsh)
> >   
> Thanks, I'll use the suggested command.
> >   
> >> diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> >> index d2694a12de61..e5bfe759a0fb 100755
> >> --- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> >> +++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh
> >> @@ -48,7 +48,7 @@ DELAY="0"        # Zero means max speed
> >>   pg_ctrl "reset"
> >>   
> >>   # Threads are specified with parameter -t value in $THREADS
> >> -for ((thread = 0; thread < $THREADS; thread++)); do
> >> +for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
> >>       # The device name is extended with @name, using thread number to
> >>       # make then unique, but any name will do.
> >>       dev=${DEV}@...hread}  
> > 
> > The expansion/use of $L_THREAD only works because "for-loop" expanded
> > it by using ""(("" arithmetic evaluation.
> >   
> After changing the one above, this one should still be OK, right?

Yes, this part is still correct.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ