11151 libpkcs11: NULL pointer errors

Review Request #1936 — Created June 1, 2019 and submitted

tsoome
illumos-gate
11151
51c9a6b...
general
../common/pkcs11SUNWExtensions.c: In function 'SUNW_C_KeyToObject':
../common/pkcs11SUNWExtensions.c:292:16: error: comparison between pointer and integer [-Werror]
  if ((hSession == NULL) || (obj == NULL) ||
                ^~
../common/pkcs11SUNWExtensions.c: In function 'pkcs11_PasswdToPBKD2Object':
../common/pkcs11SUNWExtensions.c:389:15: error: comparison between pointer and integer [-Werror]
  if (hSession == NULL || obj == NULL ||
               ^~
../common/pkcs11SUNWExtensions.c: In function 'pkcs11_ObjectToKey':
../common/pkcs11SUNWExtensions.c:513:15: error: comparison between pointer and integer [-Werror]
  if (hSession == NULL)
               ^~
../common/pkcs11SUNWExtensions.c:515:10: error: comparison between pointer and integer [-Werror]
  if (obj == NULL)
          ^~

In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                 from /code/illumos-gate/proto/root_i386/usr/include/strings.h:32,
                 from ../common/metaObject.c:31:
../common/metaObject.c: In function 'meta_CreateObject':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 6 of 'meta_freeobject_check' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/metaObject.c:183:6: note: in expansion of macro 'NULL'
      NULL)) {
      ^~~~

In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/stdlib_iso.h:50:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/stdlib.h:37,
                 from ../common/metaObjectManager.c:27:
../common/metaObjectManager.c: In function 'clone_by_wrap':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/metaObjectManager.c:1246:33: note: in expansion of macro 'NULL'
  CK_OBJECT_HANDLE wrappingKey = NULL, unwrappingKey = NULL;
                                 ^~~~
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/metaObjectManager.c:1246:55: note: in expansion of macro 'NULL'
  CK_OBJECT_HANDLE wrappingKey = NULL, unwrappingKey = NULL;
                                                       ^~~~

In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                 from /code/illumos-gate/proto/root_i386/usr/include/cryptoutil.h:36,
                 from ../common/metaUtil.c:26:
../common/metaUtil.c: In function 'meta_generate_keys':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 6 of 'meta_freeobject_check' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/metaUtil.c:980:19: note: in expansion of macro 'NULL'
      k1AttrCount, NULL)) {
                   ^~~~
In file included from ../common/metaUtil.c:31:0:
../common/metaGlobal.h:659:11: note: expected 'CK_KEY_TYPE {aka long unsigned int}' but argument is of type 'void *'
 boolean_t meta_freeobject_check(meta_session_t *session, meta_object_t *obj,
           ^~~~~~~~~~~~~~~~~~~~~
In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                 from /code/illumos-gate/proto/root_i386/usr/include/cryptoutil.h:36,
                 from ../common/metaUtil.c:26:
../common/metaUtil.c: In function 'meta_derive_key':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 6 of 'meta_freeobject_check' makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/metaUtil.c:1498:24: note: in expansion of macro 'NULL'
      ulAttributeCount, NULL)) {
                        ^~~~
In file included from ../common/metaUtil.c:31:0:
../common/metaGlobal.h:659:11: note: expected 'CK_KEY_TYPE {aka long unsigned int}' but argument is of type 'void *'
 boolean_t meta_freeobject_check(meta_session_t *session, meta_object_t *obj,
           ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


glasspelican
  1. Ship It!
  2. 
      
tsoome
jbk
  1. 
      
  2. If you wanted to be extra-super correct, you could use CK_INVALID_HANDLE (which is 0) for session or object handles.

    1. I did update few, but I hope someone else will take this module on focus:)

  3. 
      
tsoome
tsoome
Review request changed

Status: Closed (submitted)

Loading...