Print this page
new smatch


4836         if (driver_call)
4837                 mac_ring_free(mip, ring);
4838         else
4839                 ring->mr_flag = 0;
4840 }
4841 
4842 /*
4843  * Move a ring to the target group. If needed, remove the ring from the group
4844  * that it currently belongs to.
4845  *
4846  * The caller need to enter MAC's perimeter by calling mac_perim_enter().
4847  */
4848 static int
4849 mac_group_mov_ring(mac_impl_t *mip, mac_group_t *d_group, mac_ring_t *ring)
4850 {
4851         mac_group_t *s_group = (mac_group_t *)ring->mr_gh;
4852         int rv;
4853 
4854         ASSERT(MAC_PERIM_HELD((mac_handle_t)mip));
4855         ASSERT(d_group != NULL);
4856         ASSERT(s_group->mrg_mh == d_group->mrg_mh);
4857 
4858         if (s_group == d_group)
4859                 return (0);
4860 
4861         /*
4862          * Remove it from current group first.
4863          */
4864         if (s_group != NULL)
4865                 i_mac_group_rem_ring(s_group, ring, B_FALSE);
4866 
4867         /*
4868          * Add it to the new group.
4869          */
4870         rv = i_mac_group_add_ring(d_group, ring, 0);
4871         if (rv != 0) {
4872                 /*
4873                  * Failed to add ring back to source group. If
4874                  * that fails, the ring is stuck in limbo, log message.
4875                  */
4876                 if (i_mac_group_add_ring(s_group, ring, 0)) {




4836         if (driver_call)
4837                 mac_ring_free(mip, ring);
4838         else
4839                 ring->mr_flag = 0;
4840 }
4841 
4842 /*
4843  * Move a ring to the target group. If needed, remove the ring from the group
4844  * that it currently belongs to.
4845  *
4846  * The caller need to enter MAC's perimeter by calling mac_perim_enter().
4847  */
4848 static int
4849 mac_group_mov_ring(mac_impl_t *mip, mac_group_t *d_group, mac_ring_t *ring)
4850 {
4851         mac_group_t *s_group = (mac_group_t *)ring->mr_gh;
4852         int rv;
4853 
4854         ASSERT(MAC_PERIM_HELD((mac_handle_t)mip));
4855         ASSERT(d_group != NULL);
4856         ASSERT(s_group == NULL || s_group->mrg_mh == d_group->mrg_mh);
4857 
4858         if (s_group == d_group)
4859                 return (0);
4860 
4861         /*
4862          * Remove it from current group first.
4863          */
4864         if (s_group != NULL)
4865                 i_mac_group_rem_ring(s_group, ring, B_FALSE);
4866 
4867         /*
4868          * Add it to the new group.
4869          */
4870         rv = i_mac_group_add_ring(d_group, ring, 0);
4871         if (rv != 0) {
4872                 /*
4873                  * Failed to add ring back to source group. If
4874                  * that fails, the ring is stuck in limbo, log message.
4875                  */
4876                 if (i_mac_group_add_ring(s_group, ring, 0)) {