Print this page
12093 devid_scsi_encode() should use a static format string

Split Close
Expand all
Collapse all
          --- old/usr/src/common/devid/devid_scsi.c
          +++ new/usr/src/common/devid/devid_scsi.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
       28 + * Copyright 2019 Joyent, Inc.
       29 + */
       30 +
       31 +/*
  28   32   * These functions are used to encode SCSI INQUIRY data into
  29   33   * Solaris devid / guid values.
  30   34   */
  31   35  
  32   36  #ifndef _KERNEL
  33   37  #include <stdio.h>
  34   38  #endif /* _KERNEL */
  35   39  
  36   40  #include <sys/inttypes.h>
  37   41  #include <sys/types.h>
↓ open down ↓ 187 lines elided ↑ open up ↑
 225  229                                  (void) strcpy(msg, MSG_NOT_STANDARDS_COMPLIANT);
 226  230                                  (void) strncat(msg, inq_std->inq_vid,
 227  231                                      sizeof (inq_std->inq_vid));
 228  232                                  (void) strcat(msg, " ");
 229  233                                  (void) strncat(msg, inq_std->inq_pid,
 230  234                                      sizeof (inq_std->inq_pid));
 231  235                                  (void) strcat(msg, " ");
 232  236                                  (void) strncat(msg, inq_std->inq_revision,
 233  237                                      sizeof (inq_std->inq_revision));
 234  238                                  (void) strcat(msg, "\n");
 235      -                                cmn_err(CE_WARN, msg);
      239 +                                cmn_err(CE_WARN, "%s", msg);
 236  240                                  kmem_free(msg,
 237  241                                      MSG_NOT_STANDARDS_COMPLIANT_SIZE);
 238  242                          }
 239  243  #endif  /* _KERNEL */
 240  244                  }
 241  245  
 242  246                  if (id_type == DEVID_NONE) {
 243  247                          encode_scsi3_page83(version, inq83,
 244  248                              inq83_len, &id, &id_len, &id_type);
 245  249                  }
↓ open down ↓ 48 lines elided ↑ open up ↑
 294  298   *              inq83_len -
 295  299   *
 296  300   * Return Code: DEVID_RET_VALID
 297  301   *              DEVID_RET_INVALID
 298  302   *
 299  303   */
 300  304  static int
 301  305  is_page83_data_valid(uchar_t *inq83, size_t inq83_len)
 302  306  {
 303  307  
 304      -        int     covered_desc_len        = 0;
      308 +        int     covered_desc_len        = 0;
 305  309          int     dlen                    = 0;
 306  310          uchar_t *dblk                   = NULL;
 307  311  
 308  312          DEVID_ASSERT(inq83 != NULL);
 309  313  
 310  314          /* if not large enough fail */
 311  315          if (inq83_len < SCMD_MIN_INQUIRY_PAGE83_SIZE)
 312  316                  return (DEVID_RET_INVALID);
 313  317  
 314  318          /*
↓ open down ↓ 1014 lines elided ↑ open up ↑
1329 1333                      ((c >= 'A') && (c <= 'F')))
1330 1334                          c += ('a' - 'A');       /* upper to lower */
1331 1335                  *s = c;
1332 1336          }
1333 1337  }
1334 1338  
1335 1339  /*
1336 1340   * Function: scsi_wwnstr_skip_ua_prefix
1337 1341   *
1338 1342   * Description: This routine removes the leading 'w' in wwnstr,
1339      - *              if its in unit-address form.
     1343 + *              if its in unit-address form.
1340 1344   *
1341 1345   * Arguments: wwnstr - the string wwn to be transformed
1342 1346   *
1343 1347   */
1344 1348  const char *
1345 1349  scsi_wwnstr_skip_ua_prefix(const char *wwnstr)
1346 1350  {
1347 1351          if (*wwnstr == 'w')
1348 1352                  wwnstr++;
1349 1353          return (wwnstr);
↓ open down ↓ 175 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX