Print this page
10132 smatch fixes for MDB
Reviewed by: Andy Fiddaman <andy@omniosce.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/modules/fcp/fcp.c
          +++ new/usr/src/cmd/mdb/common/modules/fcp/fcp.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   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   *
  25      - * FCP mdb module
       25 + * Copyright (c) 2018, Joyent, Inc.
  26   26   */
  27   27  
  28   28  
  29   29  #include <sys/mdb_modapi.h>
  30   30  #include <sys/mutex.h>
  31   31  #include <sys/modctl.h>
  32   32  #include <sys/scsi/scsi.h>
  33   33  #include <sys/sunndi.h>
  34   34  #include <sys/fibre-channel/fc.h>
  35   35  #include <sys/fibre-channel/ulp/fcpvar.h>
↓ open down ↓ 285 lines elided ↑ open up ↑
 321  321           */
 322  322  
 323  323          if (mdb_vread(&port, sizeof (struct fcp_port), wsp->walk_addr) !=
 324  324              sizeof (struct fcp_port)) {
 325  325                  mdb_warn("Unable to read in the port structure address\n");
 326  326                  return (WALK_ERR);
 327  327          }
 328  328  
 329  329          tgt_hash_index = 0;
 330  330  
 331      -        while ((port.port_tgt_hash_table[tgt_hash_index] == NULL) &&
 332      -            (tgt_hash_index < FCP_NUM_HASH)) {
      331 +        while (tgt_hash_index < FCP_NUM_HASH &&
      332 +            port.port_tgt_hash_table[tgt_hash_index] == NULL) {
 333  333                  tgt_hash_index++;
 334  334          }
 335  335  
 336  336          wsp->walk_addr = (uintptr_t)(port.port_tgt_hash_table[tgt_hash_index]);
 337  337  
 338  338          wsp->walk_data = mdb_alloc(sizeof (struct fcp_tgt), UM_SLEEP);
 339  339  
 340  340          return (WALK_NEXT);
 341  341  }
 342  342  
↓ open down ↓ 19 lines elided ↑ open up ↑
 362  362          wsp->walk_addr =
 363  363              (uintptr_t)(((struct fcp_tgt *)wsp->walk_data)->tgt_next);
 364  364  
 365  365          if (wsp->walk_addr == NULL) {
 366  366                  /*
 367  367                   * locate the next hash list
 368  368                   */
 369  369  
 370  370                  tgt_hash_index++;
 371  371  
 372      -                while ((port.port_tgt_hash_table[tgt_hash_index] == NULL) &&
 373      -                    (tgt_hash_index < FCP_NUM_HASH)) {
      372 +                while (tgt_hash_index < FCP_NUM_HASH &&
      373 +                    port.port_tgt_hash_table[tgt_hash_index] == NULL)
 374  374                          tgt_hash_index++;
 375      -                }
 376  375  
 377  376                  if (tgt_hash_index == FCP_NUM_HASH) {
 378  377                          /* You're done */
 379  378                          return (status);
 380  379                  }
 381  380  
 382  381                  wsp->walk_addr =
 383  382                      (uintptr_t)(port.port_tgt_hash_table[tgt_hash_index]);
 384  383          }
 385  384  
↓ open down ↓ 179 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX