Print this page
5083 avoid undefined order of operations in assignments

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ib/adapters/tavor/tavor_cmd.c
          +++ new/usr/src/uts/common/io/ib/adapters/tavor/tavor_cmd.c
↓ open down ↓ 668 lines elided ↑ open up ↑
 669  669           * time to do their command.  If we signalled every time, the pollers
 670  670           * would have a much harder time getting CPU time.
 671  671           *
 672  672           * If there are waiters and no pollers, then we signal always.
 673  673           *
 674  674           * Otherwise, if there are either no waiters, there may in fact be
 675  675           * pollers, so we do not signal in that case.
 676  676           */
 677  677          if (mblist->mbl_pollers > 0 && mblist->mbl_waiters > 0) {
 678  678                  /* flip the signal value */
 679      -                mblist->mbl_signal = (++mblist->mbl_signal) % 2;
      679 +                mblist->mbl_signal = (mblist->mbl_signal + 1) % 2;
 680  680          } else if (mblist->mbl_waiters > 0) {
 681  681                  mblist->mbl_signal = 1;
 682  682          } else {
 683  683                  mblist->mbl_signal = 0;
 684  684          }
 685  685  
 686  686          /*
 687  687           * Depending on the conditions in the previous check, we signal only if
 688  688           * we are supposed to.
 689  689           */
↓ open down ↓ 2371 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX