Print this page
10117 libbe needs smatch fixes

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libbe/common/be_utils.c
          +++ new/usr/src/lib/libbe/common/be_utils.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
  25   25   * Copyright 2016 Toomas Soome <tsoome@me.com>
  26   26   * Copyright (c) 2015 by Delphix. All rights reserved.
  27   27   * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
       28 + * Copyright (c) 2018, Joyent, Inc.
  28   29   */
  29   30  
  30   31  
  31   32  /*
  32   33   * System includes
  33   34   */
  34   35  #include <assert.h>
  35   36  #include <errno.h>
  36   37  #include <libgen.h>
  37   38  #include <libintl.h>
↓ open down ↓ 225 lines elided ↑ open up ↑
 263  264  
 264  265                  if (kernel_options == NULL || *kernel_options == '\0')
 265  266                          (void) asprintf(fbarg, "/ %s "
 266  267                              "-B zfs-bootfs=%s,bootpath=\"%s\"\n", kernel,
 267  268                              node->be_root_ds, tmp);
 268  269                  else
 269  270                          (void) asprintf(fbarg, "/ %s %s "
 270  271                              "-B zfs-bootfs=%s,bootpath=\"%s\"\n", kernel,
 271  272                              kernel_options, node->be_root_ds, tmp);
 272  273  
 273      -                if (fbarg == NULL)
      274 +                if (*fbarg == NULL)
 274  275                          ret = BE_ERR_NOMEM;
 275  276                  else
 276  277                          ret = 0;
 277  278          } else
 278  279                  ret = BE_ERR_NOMEM;
 279  280  cleanup:
 280  281          if (be_mounted == B_TRUE)
 281  282                  (void) _be_unmount(node->be_node_name, BE_UNMOUNT_FLAG_FORCE);
 282  283          be_free_list(be_nodes);
 283  284  done:
↓ open down ↓ 3617 lines elided ↑ open up ↑
3901 3902                  return (BE_ERR_NOMEM);
3902 3903  
3903 3904          (void) dirname(menu_path);
3904 3905          if (*menu_path == '.') {
3905 3906                  free(menu_path);
3906 3907                  return (BE_ERR_BAD_MENU_PATH);
3907 3908          }
3908 3909          if (mkdirp(menu_path,
3909 3910              S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == -1 &&
3910 3911              errno != EEXIST) {
3911      -                free(menu_path);
3912 3912                  be_print_err(gettext("be_create_menu: Failed to create the %s "
3913 3913                      "directory: %s\n"), menu_path, strerror(errno));
     3914 +                free(menu_path);
3914 3915                  return (errno_to_be_err(errno));
3915 3916          }
3916 3917          free(menu_path);
3917 3918  
3918 3919          /*
3919 3920           * Check to see if this system supports grub
3920 3921           */
3921 3922          if (be_has_grub()) {
3922 3923                  /*
3923 3924                   * The grub menu is missing so we need to create it
↓ open down ↓ 152 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX