Project

General

Profile

Bug #12412

crypto: variable may be used uninitialized

Added by Toomas Soome 9 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
driver - device drivers
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Build errors with gcc 9:

    ../../common/crypto/io/crypto.c: In function 'get_all_mechanism_info':
    ../../common/crypto/io/crypto.c:1156:5: error: 'req_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     1156 |  if (req_count == 0 || num_mech_infos == 0 || rv != CRYPTO_SUCCESS ||
          |     ^
    ../../common/crypto/io/crypto.c: In function 'cipher':
    ../../common/crypto/io/crypto.c:2903:5: error: 'do_inplace' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2903 |  if (!do_inplace && encr.cd_raw.iov_base != NULL)
          |     ^
    ../../common/crypto/io/crypto.c: In function 'cipher_update':
    ../../common/crypto/io/crypto.c:3060:5: error: 'do_inplace' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     3060 |  if (!do_inplace && (encr.cd_raw.iov_base != NULL))
          |     ^
    ../../common/crypto/io/crypto.c: In function 'nostore_generate_key':
    ../../common/crypto/io/crypto.c:5626:3: error: 'out_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     5626 |   kmem_free(u_attrs, out_count * STRUCT_SIZE(oa));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/crypto/io/crypto.c: In function 'nostore_generate_key_pair':
    ../../common/crypto/io/crypto.c:5974:3: error: 'out_pri_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     5974 |   kmem_free(u_pri_attrs, out_pri_count * STRUCT_SIZE(oa));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/crypto/io/crypto.c:5971:3: error: 'out_pub_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     5971 |   kmem_free(u_pub_attrs, out_pub_count * STRUCT_SIZE(oa));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/crypto/io/crypto.c: In function 'nostore_derive_key':
    ../../common/crypto/io/crypto.c:6613:3: error: 'out_count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     6613 |   kmem_free(u_attrs, out_count * STRUCT_SIZE(oa));
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ../../common/crypto/io/cryptoadm.c: In function 'load_dev_disabled':
    ../../common/crypto/io/cryptoadm.c:561:3: error: 'rv' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      561 |   audit_cryptoadm(CRYPTO_LOAD_DEV_DISABLED, dev_name, entries,
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      562 |       count, instance, rv, error);
          |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../common/crypto/io/cryptoadm.c:561:3: error: 'instance' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ../../common/crypto/io/cryptoadm.c:561:3: error: 'count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ../../common/crypto/io/cryptoadm.c:561:3: error: 'entries' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ../../common/crypto/io/cryptoadm.c: In function 'load_soft_disabled':
    ../../common/crypto/io/cryptoadm.c:639:3: error: 'rv' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      639 |   audit_cryptoadm(CRYPTO_LOAD_SOFT_DISABLED, name, entries,
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      640 |       count, 0, rv, error);
          |       ~~~~~~~~~~~~~~~~~~~~
    ../../common/crypto/io/cryptoadm.c:639:3: error: 'count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ../../common/crypto/io/cryptoadm.c:639:3: error: 'entries' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ../../common/crypto/io/cryptoadm.c: In function 'load_soft_config':
    ../../common/crypto/io/cryptoadm.c:721:3: error: 'rv' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      721 |   audit_cryptoadm(CRYPTO_LOAD_SOFT_CONFIG, name, entries, count,
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      722 |       0, rv, error);
          |       ~~~~~~~~~~~~~
    ../../common/crypto/io/cryptoadm.c:721:3: error: 'count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ../../common/crypto/io/cryptoadm.c:721:3: error: 'entries' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ../../common/crypto/io/cryptoadm.c: In function 'unload_soft_module':
    ../../common/crypto/io/cryptoadm.c:766:3: error: 'rv' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      766 |   audit_cryptoadm(CRYPTO_UNLOAD_SOFT_MODULE, name, NULL, 0, 0,
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      767 |       rv, error);
          |       ~~~~~~~~~~
    cc1: all warnings being treated as errors

#1

Updated by Electric Monk 8 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit c846684c3d36ea4ee89b2cdeb2738e6521376e5a

commit  c846684c3d36ea4ee89b2cdeb2738e6521376e5a
Author: Toomas Soome <tsoome@me.com>
Date:   2020-04-07T05:36:15.000Z

    12412 crypto: variable may be used uninitialized
    Reviewed by: Jason King <jason.brian.king@gmail.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF