Print this page
8478 mac: suggest parentheses around '&&' within '||'
Reviewed by: Ryan Zezeski <rpz@joyent.com>
Reviewed by: Alexander Stetsenko <astetsenko@racktopsystems.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/mac/mac_client.c
          +++ new/usr/src/uts/common/io/mac/mac_client.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2014, Joyent, Inc.  All rights reserved.
       25 + * Copyright 2017 RackTop Systems.
  25   26   */
  26   27  
  27   28  /*
  28   29   * - General Introduction:
  29   30   *
  30   31   * This file contains the implementation of the MAC client kernel
  31   32   * API and related code. The MAC client API allows a kernel module
  32   33   * to gain access to a MAC instance (physical NIC, link aggregation, etc).
  33   34   * It allows a MAC client to associate itself with a MAC address,
  34   35   * VLANs, callback functions for data traffic and for promiscuous mode.
↓ open down ↓ 2689 lines elided ↑ open up ↑
2724 2725                  ASSERT(((flags & MAC_UNICAST_DISABLE_TX_VID_CHECK) != 0 &&
2725 2726                      (mcip->mci_state_flags & MCIS_DISABLE_TX_VID_CHECK) != 0) ||
2726 2727                      ((flags & MAC_UNICAST_DISABLE_TX_VID_CHECK) == 0 &&
2727 2728                      (mcip->mci_state_flags & MCIS_DISABLE_TX_VID_CHECK) == 0));
2728 2729  
2729 2730                  /*
2730 2731                   * Make sure the client is consistent about its requests
2731 2732                   * for MAC addresses. I.e. all requests from the clients
2732 2733                   * must have the MAC_UNICAST_HW flag set or clear.
2733 2734                   */
2734      -                if ((mcip->mci_state_flags & MCIS_UNICAST_HW) != 0 &&
2735      -                    !is_unicast_hw ||
2736      -                    (mcip->mci_state_flags & MCIS_UNICAST_HW) == 0 &&
2737      -                    is_unicast_hw) {
     2735 +                if (((mcip->mci_state_flags & MCIS_UNICAST_HW) != 0 &&
     2736 +                    !is_unicast_hw) ||
     2737 +                    ((mcip->mci_state_flags & MCIS_UNICAST_HW) == 0 &&
     2738 +                    is_unicast_hw)) {
2738 2739                          err = EINVAL;
2739 2740                          goto bail_out;
2740 2741                  }
2741 2742          }
2742 2743          /*
2743 2744           * Make sure the MAC address is not already used by
2744 2745           * another MAC client defined on top of the same
2745 2746           * underlying NIC. Unless we have MAC_CLIENT_FLAGS_MULTI_PRIMARY
2746 2747           * set when we allow a passive client to be present which will
2747 2748           * be activated when the currently active client goes away - this
↓ open down ↓ 2828 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX