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/mdb/mdb_cmds.c
          +++ new/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
↓ open down ↓ 1512 lines elided ↑ open up ↑
1513 1513                  return ("[ heap ]");
1514 1514          if (name != NULL && name[0] != 0)
1515 1515                  return (name);
1516 1516  
1517 1517          if (map->map_flags & MDB_TGT_MAP_SHMEM)
1518 1518                  return ("[ shmem ]");
1519 1519          if (map->map_flags & MDB_TGT_MAP_STACK)
1520 1520                  return ("[ stack ]");
1521 1521          if (map->map_flags & MDB_TGT_MAP_ANON)
1522 1522                  return ("[ anon ]");
1523      -        if (map->map_name != NULL)
1524      -                return (map->map_name);
1525      -        return ("[ unknown ]");
     1523 +        if (map->map_name[0] == '\0')
     1524 +                return ("[ unknown ]");
     1525 +        return (map->map_name);
1526 1526  }
1527 1527  
1528 1528  /*ARGSUSED*/
1529 1529  static int
1530 1530  print_map(void *ignored, const mdb_map_t *map, const char *name)
1531 1531  {
1532 1532          name = map_name(map, name);
1533 1533  
1534 1534          mdb_printf("%?p %?p %?lx %s\n", map->map_base,
1535 1535              map->map_base + map->map_size, map->map_size, name);
↓ open down ↓ 800 lines elided ↑ open up ↑
2336 2336  }
2337 2337  
2338 2338  /*ARGSUSED*/
2339 2339  static int
2340 2340  cmd_head(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2341 2341  {
2342 2342          uint64_t cnt = 10;
2343 2343          const char *c;
2344 2344          mdb_pipe_t p;
2345 2345  
2346      -        if (!flags & DCMD_PIPE)
     2346 +        if (!(flags & DCMD_PIPE))
2347 2347                  return (DCMD_USAGE);
2348 2348  
2349 2349          if (argc == 1 || argc == 2) {
2350 2350                  const char *num;
2351 2351  
2352 2352                  if (argc == 1) {
2353 2353                          if (argv[0].a_type != MDB_TYPE_STRING ||
2354 2354                              *argv[0].a_un.a_str != '-')
2355 2355                                  return (DCMD_USAGE);
2356 2356  
↓ open down ↓ 903 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX