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/hermon/hermon_cmd.c
          +++ new/usr/src/uts/common/io/ib/adapters/hermon/hermon_cmd.c
↓ open down ↓ 689 lines elided ↑ open up ↑
 690  690           * time to do their command.  If we signalled every time, the pollers
 691  691           * would have a much harder time getting CPU time.
 692  692           *
 693  693           * If there are waiters and no pollers, then we signal always.
 694  694           *
 695  695           * Otherwise, if there are either no waiters, there may in fact be
 696  696           * pollers, so we do not signal in that case.
 697  697           */
 698  698          if (mblist->mbl_pollers > 0 && mblist->mbl_waiters > 0) {
 699  699                  /* flip the signal value */
 700      -                mblist->mbl_signal = (++mblist->mbl_signal) % 2;
      700 +                mblist->mbl_signal = (mblist->mbl_signal + 1) % 2;
 701  701          } else if (mblist->mbl_waiters > 0) {
 702  702                  mblist->mbl_signal = 1;
 703  703          } else {
 704  704                  mblist->mbl_signal = 0;
 705  705          }
 706  706  
 707  707          /*
 708  708           * Depending on the conditions in the previous check, we signal only if
 709  709           * we are supposed to.
 710  710           */
↓ open down ↓ 3003 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX