Print this page
OS-1576 Sundry uninitialised variables
Reviewed by: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/modules/v8/mdb_v8.c
          +++ new/usr/src/cmd/mdb/common/modules/v8/mdb_v8.c
↓ open down ↓ 1491 lines elided ↑ open up ↑
1492 1492  }
1493 1493  
1494 1494  /*
1495 1495   * Given the line endings table in "lendsp", computes the line number for the
1496 1496   * given token position and print the result into "buf".  If "lendsp" is
1497 1497   * undefined, prints the token position instead.
1498 1498   */
1499 1499  static int
1500 1500  jsfunc_lineno(uintptr_t lendsp, uintptr_t tokpos, char *buf, size_t buflen)
1501 1501  {
1502      -        uintptr_t size, bufsz, lower, upper, ii;
     1502 +        uintptr_t size, bufsz, lower, upper, ii = 0;
1503 1503          uintptr_t *data;
1504 1504  
1505 1505          if (jsobj_is_undefined(lendsp)) {
1506 1506                  /*
1507 1507                   * The token position is an SMI, but it comes in as its raw
1508 1508                   * value so we can more easily compare it to values in the line
1509 1509                   * endings table.  If we're just printing the position directly,
1510 1510                   * we must convert it here.
1511 1511                   */
1512 1512                  mdb_snprintf(buf, buflen, "position %d", V8_SMI_VALUE(tokpos));
↓ open down ↓ 1314 lines elided ↑ open up ↑
2827 2827          return (rv == 0 ? DCMD_OK : DCMD_ERR);
2828 2828  }
2829 2829  
2830 2830  /* ARGSUSED */
2831 2831  static int
2832 2832  dcmd_v8field(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2833 2833  {
2834 2834          v8_class_t *clp;
2835 2835          v8_field_t *flp;
2836 2836          const char *klass, *field;
2837      -        uintptr_t offset;
     2837 +        uintptr_t offset = 0;
2838 2838  
2839 2839          /*
2840 2840           * We may be invoked with either two arguments (class and field name) or
2841 2841           * three (an offset to save).
2842 2842           */
2843 2843          if (argc != 2 && argc != 3)
2844 2844                  return (DCMD_USAGE);
2845 2845  
2846 2846          if (argv[0].a_type != MDB_TYPE_STRING ||
2847 2847              argv[1].a_type != MDB_TYPE_STRING)
↓ open down ↓ 139 lines elided ↑ open up ↑
2987 2987                  mdb_printf("%-10s    %s\n", cfp->v8cfg_name, cfp->v8cfg_label);
2988 2988          }
2989 2989  
2990 2990          (void) mdb_dec_indent(4);
2991 2991  }
2992 2992  
2993 2993  /* ARGSUSED */
2994 2994  static int
2995 2995  dcmd_v8load(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2996 2996  {
2997      -        v8_cfg_t *cfgp, **cfgpp;
     2997 +        v8_cfg_t *cfgp = NULL, **cfgpp;
2998 2998  
2999 2999          if (v8_classes != NULL) {
3000 3000                  mdb_warn("v8 module already configured\n");
3001 3001                  return (DCMD_ERR);
3002 3002          }
3003 3003  
3004 3004          if (argc < 1 || argv->a_type != MDB_TYPE_STRING)
3005 3005                  return (DCMD_USAGE);
3006 3006  
3007 3007          for (cfgpp = v8_cfgs; *cfgpp != NULL; cfgpp++) {
3008 3008                  cfgp = *cfgpp;
3009 3009                  if (strcmp(argv->a_un.a_str, cfgp->v8cfg_name) == 0)
3010 3010                          break;
3011 3011          }
3012 3012  
3013      -        if (cfgp->v8cfg_name == NULL) {
     3013 +        if (cfgp == NULL || cfgp->v8cfg_name == NULL) {
3014 3014                  mdb_warn("unknown configuration: \"%s\"\n", argv->a_un.a_str);
3015 3015                  return (DCMD_ERR);
3016 3016          }
3017 3017  
3018 3018          if (autoconfigure(cfgp) == -1) {
3019 3019                  mdb_warn("autoconfigure failed\n");
3020 3020                  return (DCMD_ERR);
3021 3021          }
3022 3022  
3023 3023          mdb_printf("V8 dmod configured based on %s\n", cfgp->v8cfg_name);
↓ open down ↓ 169 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX