From fd7977362aae2eaa5dcb89671159f4fd82f22ca1 Mon Sep 17 00:00:00 2001 From: John Levon Date: Fri, 15 Mar 2019 17:34:12 +0000 Subject: 10570 Need workaround to EFI boot on AMI BIOS Reviewed by: Jerry Jelinek Reviewed by: Robert Mustacchi Reviewed by: Toomas Soome Reviewed by: Andy Stormont Approved by: Richard Lowe --- usr/src/lib/libefi/common/rdwr_efi.c | 26 ++++++++++++-------------- usr/src/uts/common/fs/zfs/zvol.c | 5 +++-- usr/src/uts/common/io/cmlb.c | 3 ++- usr/src/uts/common/sys/efi_partition.h | 14 +++++++++++++- usr/src/uts/sun4v/io/vds.c | 5 +++-- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/usr/src/lib/libefi/common/rdwr_efi.c b/usr/src/lib/libefi/common/rdwr_efi.c index e0d866e3c4..0e87baeca3 100644 --- a/usr/src/lib/libefi/common/rdwr_efi.c +++ b/usr/src/lib/libefi/common/rdwr_efi.c @@ -24,7 +24,7 @@ * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2014 Toomas Soome * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ #include @@ -341,9 +341,8 @@ check_label(int fd, dk_efi_t *dk_ioc) if (efi_debug) (void) fprintf(stderr, "Bad EFI CRC: 0x%x != 0x%x\n", - crc, - LE_32(efi_crc32((unsigned char *)efi, - sizeof (struct efi_gpt)))); + crc, LE_32(efi_crc32((unsigned char *)efi, + LE_32(efi->efi_gpt_HeaderSize)))); return (VT_EINVAL); } @@ -715,7 +714,7 @@ write_pmbr(int fd, struct dk_gpt *vtoc) hardware_workarounds(&slot, &active); len = (vtoc->efi_lbasize == 0) ? sizeof (mb) : vtoc->efi_lbasize; - buf = calloc(len, 1); + buf = calloc(1, len); /* * Preserve any boot code and disk signature if the first block is @@ -741,10 +740,10 @@ write_pmbr(int fd, struct dk_gpt *vtoc) cp = (uchar_t *)&mb.parts[slot * sizeof (struct ipart)]; /* bootable or not */ *cp++ = active ? ACTIVE : NOTACTIVE; - /* beginning CHS; 0xffffff if not representable */ - *cp++ = 0xff; - *cp++ = 0xff; - *cp++ = 0xff; + /* beginning CHS; same as starting LBA (but one-based) */ + *cp++ = 0x0; + *cp++ = 0x2; + *cp++ = 0x0; /* OS type */ *cp++ = EFI_PMBR; /* ending CHS; 0xffffff if not representable */ @@ -1029,7 +1028,7 @@ efi_write(int fd, struct dk_gpt *vtoc) /* stuff user's input into EFI struct */ efi->efi_gpt_Signature = LE_64(EFI_SIGNATURE); efi->efi_gpt_Revision = LE_32(vtoc->efi_version); /* 0x02000100 */ - efi->efi_gpt_HeaderSize = LE_32(sizeof (struct efi_gpt)); + efi->efi_gpt_HeaderSize = LE_32(EFI_HEADER_SIZE); efi->efi_gpt_Reserved1 = 0; efi->efi_gpt_MyLBA = LE_64(1ULL); efi->efi_gpt_AlternateLBA = LE_64(lba_backup_gpt_hdr); @@ -1094,8 +1093,8 @@ efi_write(int fd, struct dk_gpt *vtoc) efi->efi_gpt_PartitionEntryArrayCRC32 = LE_32(efi_crc32((unsigned char *)efi_parts, vtoc->efi_nparts * (int)sizeof (struct efi_gpe))); - efi->efi_gpt_HeaderCRC32 = - LE_32(efi_crc32((unsigned char *)efi, sizeof (struct efi_gpt))); + efi->efi_gpt_HeaderCRC32 = LE_32(efi_crc32((unsigned char *)efi, + EFI_HEADER_SIZE)); if (efi_ioctl(fd, DKIOCSETEFI, &dk_ioc) == -1) { free(dk_ioc.dki_data); @@ -1142,8 +1141,7 @@ efi_write(int fd, struct dk_gpt *vtoc) efi->efi_gpt_PartitionEntryLBA = LE_64(vtoc->efi_last_u_lba + 1); efi->efi_gpt_HeaderCRC32 = 0; efi->efi_gpt_HeaderCRC32 = - LE_32(efi_crc32((unsigned char *)dk_ioc.dki_data, - sizeof (struct efi_gpt))); + LE_32(efi_crc32((unsigned char *)dk_ioc.dki_data, EFI_HEADER_SIZE)); if (efi_ioctl(fd, DKIOCSETEFI, &dk_ioc) == -1) { if (efi_debug) { diff --git a/usr/src/uts/common/fs/zfs/zvol.c b/usr/src/uts/common/fs/zfs/zvol.c index 3566984ab4..10ea804f8d 100644 --- a/usr/src/uts/common/fs/zfs/zvol.c +++ b/usr/src/uts/common/fs/zfs/zvol.c @@ -27,6 +27,7 @@ * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2019, Joyent, Inc. */ /* @@ -1509,7 +1510,7 @@ zvol_getefi(void *arg, int flag, uint64_t vs, uint8_t bs) gpt.efi_gpt_Signature = LE_64(EFI_SIGNATURE); gpt.efi_gpt_Revision = LE_32(EFI_VERSION_CURRENT); - gpt.efi_gpt_HeaderSize = LE_32(sizeof (gpt)); + gpt.efi_gpt_HeaderSize = LE_32(EFI_HEADER_SIZE); gpt.efi_gpt_MyLBA = LE_64(1ULL); gpt.efi_gpt_FirstUsableLBA = LE_64(34ULL); gpt.efi_gpt_LastUsableLBA = LE_64((vs >> bs) - 1); @@ -1519,7 +1520,7 @@ zvol_getefi(void *arg, int flag, uint64_t vs, uint8_t bs) LE_32(sizeof (efi_gpe_t)); CRC32(crc, &gpe, sizeof (gpe), -1U, crc32_table); gpt.efi_gpt_PartitionEntryArrayCRC32 = LE_32(~crc); - CRC32(crc, &gpt, sizeof (gpt), -1U, crc32_table); + CRC32(crc, &gpt, EFI_HEADER_SIZE, -1U, crc32_table); gpt.efi_gpt_HeaderCRC32 = LE_32(~crc); if (ddi_copyout(&gpt, ptr, MIN(sizeof (gpt), length), flag)) diff --git a/usr/src/uts/common/io/cmlb.c b/usr/src/uts/common/io/cmlb.c index 49e4e1a39d..6275948465 100644 --- a/usr/src/uts/common/io/cmlb.c +++ b/usr/src/uts/common/io/cmlb.c @@ -24,6 +24,7 @@ * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2016 Toomas Soome + * Copyright (c) 2019, Joyent, Inc. */ /* @@ -2747,7 +2748,7 @@ cmlb_validate_efi(efi_gpt_t *labp) { if (labp->efi_gpt_Signature != EFI_SIGNATURE) return (EINVAL); - /* at least 96 bytes in this version of the spec. */ + /* at least 92 bytes in this version of the spec. */ if (sizeof (efi_gpt_t) - sizeof (labp->efi_gpt_Reserved2) > labp->efi_gpt_HeaderSize) return (EINVAL); diff --git a/usr/src/uts/common/sys/efi_partition.h b/usr/src/uts/common/sys/efi_partition.h index 5fa101cbb7..065f65f802 100644 --- a/usr/src/uts/common/sys/efi_partition.h +++ b/usr/src/uts/common/sys/efi_partition.h @@ -22,12 +22,14 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright 2014 Toomas Soome + * Copyright (c) 2019, Joyent, Inc. */ #ifndef _SYS_EFI_PARTITION_H #define _SYS_EFI_PARTITION_H #include +#include #ifdef __cplusplus extern "C" { @@ -46,6 +48,16 @@ extern "C" { #define EFI_SIGNATURE 0x5452415020494645ULL +/* + * Although the EFI spec is clear that sizeof (efi_gpt_t) is a valid value + * (512), at least one EFI system (AMI v4.6.4.1) incorrectly expects this to be + * exactly the size of the structure defined in the spec, that is, 92. + * + * As the reserved section is never used, the modified value works fine + * everywhere else. + */ +#define EFI_HEADER_SIZE (offsetof(efi_gpt_t, efi_gpt_Reserved2)) + /* EFI Guid Partition Table Header -- little endian on-disk format */ typedef struct efi_gpt { uint64_t efi_gpt_Signature; @@ -222,7 +234,7 @@ typedef struct dk_efi { diskaddr_t dki_lba; /* starting block */ len_t dki_length; /* length in bytes */ union { - efi_gpt_t *_dki_data; + efi_gpt_t *_dki_data; uint64_t _dki_data_64; } dki_un; #define dki_data dki_un._dki_data diff --git a/usr/src/uts/sun4v/io/vds.c b/usr/src/uts/sun4v/io/vds.c index dee390142b..15d263a1b9 100644 --- a/usr/src/uts/sun4v/io/vds.c +++ b/usr/src/uts/sun4v/io/vds.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, Joyent, Inc. */ /* @@ -5832,7 +5833,7 @@ vd_setup_partition_efi(vd_t *vd) gpt->efi_gpt_Signature = LE_64(EFI_SIGNATURE); gpt->efi_gpt_Revision = LE_32(EFI_VERSION_CURRENT); - gpt->efi_gpt_HeaderSize = LE_32(sizeof (efi_gpt_t)); + gpt->efi_gpt_HeaderSize = LE_32(EFI_HEADER_SIZE); gpt->efi_gpt_FirstUsableLBA = LE_64(first_u_lba); gpt->efi_gpt_PartitionEntryLBA = LE_64(2ULL); gpt->efi_gpt_SizeOfPartitionEntry = LE_32(sizeof (efi_gpe_t)); @@ -5869,7 +5870,7 @@ vd_setup_partition_efi(vd_t *vd) CRC32(crc, gpe, sizeof (efi_gpe_t) * VD_MAXPART, -1U, crc32_table); gpt->efi_gpt_PartitionEntryArrayCRC32 = LE_32(~crc); - CRC32(crc, gpt, sizeof (efi_gpt_t), -1U, crc32_table); + CRC32(crc, gpt, EFI_HEADER_SIZE, -1U, crc32_table); gpt->efi_gpt_HeaderCRC32 = LE_32(~crc); return (0); -- cgit v1.2.3 From dd328bf6d39366b8d7bde6a36114538fc14332dd Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sat, 19 Jan 2019 21:05:21 +0200 Subject: 10731 zfs: NULL pointer errors Reviewed by: Sebastian Wiedenroth Approved by: Dan McDonald --- usr/src/uts/common/fs/zfs/dsl_pool.c | 3 +-- usr/src/uts/common/fs/zfs/sa.c | 4 ++-- usr/src/uts/common/fs/zfs/zcp.c | 18 +++++++++--------- usr/src/uts/common/fs/zfs/zcp_get.c | 7 +++---- usr/src/uts/common/fs/zfs/zcp_global.c | 2 +- usr/src/uts/common/fs/zfs/zcp_iter.c | 20 ++++++++++---------- usr/src/uts/common/fs/zfs/zcp_synctask.c | 16 ++++++++-------- usr/src/uts/common/fs/zfs/zfs_ioctl.c | 12 ++++++------ 8 files changed, 40 insertions(+), 42 deletions(-) diff --git a/usr/src/uts/common/fs/zfs/dsl_pool.c b/usr/src/uts/common/fs/zfs/dsl_pool.c index 08a35f68f3..54c88b1e3c 100644 --- a/usr/src/uts/common/fs/zfs/dsl_pool.c +++ b/usr/src/uts/common/fs/zfs/dsl_pool.c @@ -1150,8 +1150,7 @@ int dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag, dmu_tx_t *tx) { - return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, NULL, - tx, B_FALSE)); + return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, tx, B_FALSE)); } /* diff --git a/usr/src/uts/common/fs/zfs/sa.c b/usr/src/uts/common/fs/zfs/sa.c index 4a70e3916b..d8cf42db5f 100644 --- a/usr/src/uts/common/fs/zfs/sa.c +++ b/usr/src/uts/common/fs/zfs/sa.c @@ -1577,12 +1577,12 @@ sa_attr_register_sync(sa_handle_t *hdl, dmu_tx_t *tx) mutex_enter(&sa->sa_lock); - if (!sa->sa_need_attr_registration || sa->sa_master_obj == NULL) { + if (!sa->sa_need_attr_registration || sa->sa_master_obj == 0) { mutex_exit(&sa->sa_lock); return; } - if (sa->sa_reg_attr_obj == NULL) { + if (sa->sa_reg_attr_obj == 0) { sa->sa_reg_attr_obj = zap_create_link(hdl->sa_os, DMU_OT_SA_ATTR_REGISTRATION, sa->sa_master_obj, SA_REGISTRY, tx); diff --git a/usr/src/uts/common/fs/zfs/zcp.c b/usr/src/uts/common/fs/zfs/zcp.c index a3ac9a9824..61ce60a233 100644 --- a/usr/src/uts/common/fs/zfs/zcp.c +++ b/usr/src/uts/common/fs/zfs/zcp.c @@ -593,23 +593,23 @@ zcp_dataset_hold_error(lua_State *state, dsl_pool_t *dp, const char *dsname, { if (error == ENOENT) { (void) zcp_argerror(state, 1, "no such dataset '%s'", dsname); - return (NULL); /* not reached; zcp_argerror will longjmp */ + return (0); /* not reached; zcp_argerror will longjmp */ } else if (error == EXDEV) { (void) zcp_argerror(state, 1, "dataset '%s' is not in the target pool '%s'", dsname, spa_name(dp->dp_spa)); - return (NULL); /* not reached; zcp_argerror will longjmp */ + return (0); /* not reached; zcp_argerror will longjmp */ } else if (error == EIO) { (void) luaL_error(state, "I/O error while accessing dataset '%s'", dsname); - return (NULL); /* not reached; luaL_error will longjmp */ + return (0); /* not reached; luaL_error will longjmp */ } else if (error != 0) { (void) luaL_error(state, "unexpected error %d while accessing dataset '%s'", error, dsname); - return (NULL); /* not reached; luaL_error will longjmp */ + return (0); /* not reached; luaL_error will longjmp */ } - return (NULL); + return (0); } /* @@ -632,10 +632,10 @@ static zcp_lib_info_t zcp_debug_info = { .func = zcp_debug, .pargs = { { .za_name = "debug string", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -661,10 +661,10 @@ static zcp_lib_info_t zcp_exists_info = { .func = zcp_exists, .pargs = { { .za_name = "dataset", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; diff --git a/usr/src/uts/common/fs/zfs/zcp_get.c b/usr/src/uts/common/fs/zfs/zcp_get.c index 85e00a0f93..1478c288d8 100644 --- a/usr/src/uts/common/fs/zfs/zcp_get.c +++ b/usr/src/uts/common/fs/zfs/zcp_get.c @@ -330,8 +330,7 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, const char *dsname, error = get_clones_stat_impl(ds, clones); if (error == 0) { /* push list to lua stack */ - VERIFY0(zcp_nvlist_to_lua(state, clones, NULL, - NULL)); + VERIFY0(zcp_nvlist_to_lua(state, clones, NULL, 0)); /* source */ (void) lua_pushnil(state); } @@ -792,10 +791,10 @@ static zcp_lib_info_t zcp_get_prop_info = { .pargs = { { .za_name = "dataset", .za_lua_type = LUA_TSTRING}, { .za_name = "property", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; diff --git a/usr/src/uts/common/fs/zfs/zcp_global.c b/usr/src/uts/common/fs/zfs/zcp_global.c index 9a869a6012..c25431fd67 100644 --- a/usr/src/uts/common/fs/zfs/zcp_global.c +++ b/usr/src/uts/common/fs/zfs/zcp_global.c @@ -68,7 +68,7 @@ static const zcp_errno_global_t errno_globals[] = { {"ENOTSUP", ENOTSUP}, {"EDQUOT", EDQUOT}, {"ENAMETOOLONG", ENAMETOOLONG}, - {NULL, NULL} + {NULL, 0} }; static void diff --git a/usr/src/uts/common/fs/zfs/zcp_iter.c b/usr/src/uts/common/fs/zfs/zcp_iter.c index 351e400fb5..0236c6474e 100644 --- a/usr/src/uts/common/fs/zfs/zcp_iter.c +++ b/usr/src/uts/common/fs/zfs/zcp_iter.c @@ -110,10 +110,10 @@ static zcp_list_info_t zcp_clones_list_info = { .gc = NULL, .pargs = { { .za_name = "snapshot", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -199,10 +199,10 @@ static zcp_list_info_t zcp_snapshots_list_info = { .gc = NULL, .pargs = { { .za_name = "filesystem | volume", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -300,10 +300,10 @@ static zcp_list_info_t zcp_children_list_info = { .gc = NULL, .pargs = { { .za_name = "filesystem | volume", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -381,10 +381,10 @@ static zcp_list_info_t zcp_props_list_info = { .pargs = { { .za_name = "filesystem | snapshot | volume", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -439,10 +439,10 @@ static zcp_list_info_t zcp_system_props_list_info = { .func = zcp_system_props_list, .pargs = { { .za_name = "dataset", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; diff --git a/usr/src/uts/common/fs/zfs/zcp_synctask.c b/usr/src/uts/common/fs/zfs/zcp_synctask.c index 1441a3882a..25d970ec08 100644 --- a/usr/src/uts/common/fs/zfs/zcp_synctask.c +++ b/usr/src/uts/common/fs/zfs/zcp_synctask.c @@ -104,11 +104,11 @@ static zcp_synctask_info_t zcp_synctask_destroy_info = { .func = zcp_synctask_destroy, .pargs = { {.za_name = "filesystem | snapshot", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { {.za_name = "defer", .za_lua_type = LUA_TBOOLEAN}, - {NULL, NULL} + {NULL, 0} }, .space_check = ZFS_SPACE_CHECK_DESTROY, .blocks_modified = 0 @@ -157,10 +157,10 @@ static zcp_synctask_info_t zcp_synctask_promote_info = { .func = zcp_synctask_promote, .pargs = { {.za_name = "clone", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} }, .space_check = ZFS_SPACE_CHECK_RESERVED, .blocks_modified = 3 @@ -196,10 +196,10 @@ static zcp_synctask_info_t zcp_synctask_rollback_info = { .blocks_modified = 1, .pargs = { {.za_name = "filesystem", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} } }; @@ -226,10 +226,10 @@ static zcp_synctask_info_t zcp_synctask_snapshot_info = { .pargs = { {.za_name = "filesystem@snapname | volume@snapname", .za_lua_type = LUA_TSTRING}, - {NULL, NULL} + {NULL, 0} }, .kwargs = { - {NULL, NULL} + {NULL, 0} }, .space_check = ZFS_SPACE_CHECK_NORMAL, .blocks_modified = 3 diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c index c0f7a28706..712abee22f 100644 --- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c @@ -307,7 +307,7 @@ history_str_get(zfs_cmd_t *zc) { char *buf; - if (zc->zc_history == NULL) + if (zc->zc_history == 0) return (NULL); buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP); @@ -2222,7 +2222,7 @@ zfs_ioc_objset_zplprops(zfs_cmd_t *zc) * which we aren't supposed to do with a DS_MODE_USER * hold, because it could be inconsistent. */ - if (zc->zc_nvlist_dst != NULL && + if (zc->zc_nvlist_dst != 0 && !zc->zc_objset_stats.dds_inconsistent && dmu_objset_type(os) == DMU_OST_ZFS) { nvlist_t *nv; @@ -2779,7 +2779,7 @@ zfs_ioc_set_prop(zfs_cmd_t *zc) if (error == 0) error = zfs_set_prop_nvlist(zc->zc_name, source, nvl, errors); - if (zc->zc_nvlist_dst != NULL && errors != NULL) { + if (zc->zc_nvlist_dst != 0 && errors != NULL) { (void) put_nvlist(zc, errors); } @@ -2930,7 +2930,7 @@ zfs_ioc_pool_get_props(zfs_cmd_t *zc) spa_close(spa, FTAG); } - if (error == 0 && zc->zc_nvlist_dst != NULL) + if (error == 0 && zc->zc_nvlist_dst != 0) error = put_nvlist(zc, nvp); else error = SET_ERROR(EFAULT); @@ -4411,7 +4411,7 @@ zfs_ioc_recv(zfs_cmd_t *zc) tosnap = strchr(tofs, '@'); *tosnap++ = '\0'; - if (zc->zc_nvlist_src != NULL && + if (zc->zc_nvlist_src != 0 && (error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, zc->zc_iflags, &props)) != 0) return (error); @@ -4835,7 +4835,7 @@ zfs_ioc_clear(zfs_cmd_t *zc) nvlist_t *policy; nvlist_t *config = NULL; - if (zc->zc_nvlist_src == NULL) + if (zc->zc_nvlist_src == 0) return (SET_ERROR(EINVAL)); if ((error = get_nvlist(zc->zc_nvlist_src, -- cgit v1.2.3 From 483e494a59954f25ec067f2dee3cd94a269eaa08 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 13:01:20 +0200 Subject: 10752 fcsm: NULL pointer errors Reviewed by: Sebastian Wiedenroth Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/common/io/fibre-channel/ulp/fcsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/src/uts/common/io/fibre-channel/ulp/fcsm.c b/usr/src/uts/common/io/fibre-channel/ulp/fcsm.c index ce6c77a117..9efc1cb337 100644 --- a/usr/src/uts/common/io/fibre-channel/ulp/fcsm.c +++ b/usr/src/uts/common/io/fibre-channel/ulp/fcsm.c @@ -430,7 +430,7 @@ fcsm_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) /* Create a minor node */ if (ddi_create_minor_node(fcsm_dip, "fcsm", S_IFCHR, - NULL, DDI_PSEUDO, 0) == DDI_SUCCESS) { + 0, DDI_PSEUDO, 0) == DDI_SUCCESS) { /* Announce presence of the device */ mutex_exit(&fcsm_global_mutex); ddi_report_dev(dip); -- cgit v1.2.3 From c92b35bb664ce1e1d7dc0a4dcdcc791aef0fe69e Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 13:11:47 +0200 Subject: 10753 qlc: NULL pointer errors Reviewed by: Marcel Telka Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c | 14 +++++++------- usr/src/uts/common/io/fibre-channel/fca/qlc/ql_debug.c | 8 ++++---- usr/src/uts/common/io/fibre-channel/fca/qlc/ql_ioctl.c | 10 +++++----- usr/src/uts/common/io/fibre-channel/fca/qlc/ql_xioctl.c | 4 ++-- usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_api.h | 16 ++++++++-------- usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_mbx.h | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c index 4a4731bf90..571ad7f01e 100644 --- a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c +++ b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_api.c @@ -2663,7 +2663,7 @@ ql_un_init_pkt(opaque_t fca_handle, fc_packet_t *pkt) EL(ha, "failed, FC_BADPACKET\n"); rval = FC_BADPACKET; } else { - sp->magic_number = NULL; + sp->magic_number = 0; ql_free_phys(ha, &sp->sg_dma); rval = FC_SUCCESS; } @@ -5240,7 +5240,7 @@ ql_els_flogi(ql_adapter_state_t *ha, fc_packet_t *pkt) } else { tq = ql_d_id_to_queue(ha, d_id); } - if ((tq != NULL) || (accept != NULL)) { + if ((tq != NULL) || (accept != 0)) { /* Build ACC. */ pkt->pkt_state = FC_PKT_SUCCESS; class3_param = (class_svc_param_t *)&acc.class_3; @@ -9704,9 +9704,9 @@ ql_timer(void *arg) #endif ha->idle_timer = 0; } - if (ha->send_plogi_timer != NULL) { + if (ha->send_plogi_timer != 0) { ha->send_plogi_timer--; - if (ha->send_plogi_timer == NULL) { + if (ha->send_plogi_timer == 0) { set_flags |= SEND_PLOGI; } } @@ -15618,8 +15618,8 @@ ql_alloc_phys(ql_adapter_state_t *ha, dma_mem_t *mem, int sleep) &mem->acc_handle) == DDI_SUCCESS) { bzero(mem->bp, mem->size); /* ensure we got what we asked for (32bit) */ - if (dma_attr.dma_attr_addr_hi == NULL) { - if (mem->cookie.dmac_notused != NULL) { + if (dma_attr.dma_attr_addr_hi == 0) { + if (mem->cookie.dmac_notused != 0) { EL(ha, "failed, ddi_dma_mem_alloc " "returned 64 bit DMA address\n"); ql_free_phys(ha, mem); @@ -16796,7 +16796,7 @@ ql_disable_intr(ql_adapter_state_t *ha) static void ql_release_intr(ql_adapter_state_t *ha) { - int32_t i; + int32_t i; QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance); diff --git a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_debug.c b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_debug.c index 9961ed8a2a..eb5ff8f139 100644 --- a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_debug.c +++ b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_debug.c @@ -55,7 +55,7 @@ char *ql_find_trace_start(ql_adapter_state_t *ha); uint32_t el_message_number = 0; uint32_t ql_enable_ellock = 0; -extern int getpcstack(pc_t *, int); +extern int getpcstack(pc_t *, int); extern char *kobj_getsymname(uintptr_t, ulong_t *); /* @@ -512,7 +512,7 @@ ql_dump_el_trace_buffer(ql_adapter_state_t *ha) TRACE_BUFFER_LOCK(ha); rval = ql_validate_trace_desc(ha); - if (rval != NULL) { + if (rval != 0) { cmn_err(CE_CONT, "%s(%d) Dump EL trace - invalid desc\n", QL_NAME, ha->instance); } else if ((dump_start = ql_find_trace_start(ha)) != NULL) { @@ -542,7 +542,7 @@ ql_dump_el_trace_buffer(ql_adapter_state_t *ha) dump_current) { break; } - } else if (*dump_current == NULL) { + } else if (*dump_current == '\0') { break; } } @@ -606,7 +606,7 @@ ql_find_trace_start(ql_adapter_state_t *ha) (ha->el_trace_desc->trace_buffer + ha->el_trace_desc->trace_buffer_size)) { trace_start = ha->el_trace_desc->trace_buffer; - } else if (*trace_next != NULL) { + } else if (*trace_next != '\0') { trace_start = trace_next + (strlen(trace_next) + 1); } else { trace_start = ha->el_trace_desc->trace_buffer; diff --git a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_ioctl.c b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_ioctl.c index 33f83dcda8..05e8b2c4d2 100644 --- a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_ioctl.c +++ b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_ioctl.c @@ -1047,7 +1047,7 @@ ql_nv_util_dump(ql_adapter_state_t *ha, void *bp, int mode) QL_PRINT_9(CE_CONT, "(%d): started\n", ha->instance); if (ha->nvram_cache == NULL || - ha->nvram_cache->size == NULL || + ha->nvram_cache->size == 0 || ha->nvram_cache->cache == NULL) { EL(ha, "failed, kmem_zalloc\n"); return (ENOMEM); @@ -1526,11 +1526,11 @@ ql_vpd_lookup(ql_adapter_state_t *ha, uint8_t *opcode, uint8_t *bp, /* copy the data back */ (void) strncpy((int8_t *)bp, (int8_t *)(vpd+3), (int64_t)len); - bp[len] = NULL; + bp[len] = 0; } else { /* error -- couldn't find tag */ - bp[0] = NULL; - if (opcode[1] != NULL) { + bp[0] = 0; + if (opcode[1] != 0) { EL(ha, "unable to find tag '%s'\n", opcode); } else { EL(ha, "unable to find tag '%xh'\n", opcode[0]); @@ -2443,7 +2443,7 @@ ql_adm_updfwmodule(ql_adapter_state_t *ha, ql_adm_op_t *dop, int mode) for (link = ql_hba.first; link != NULL; link = link->next) { ha2 = link->base_address; - if ((fw_class == ha2->fw_class) && (ha2->fw_class == NULL)) { + if ((fw_class == ha2->fw_class) && (ha2->fw_class == 0)) { if ((rval = (int32_t)ql_fwmodule_resolve(ha2)) != QL_SUCCESS) { EL(ha2, "unable to load f/w module: '%x' " diff --git a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_xioctl.c b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_xioctl.c index 1c9f015d8f..1651edab96 100644 --- a/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_xioctl.c +++ b/usr/src/uts/common/io/fibre-channel/fca/qlc/ql_xioctl.c @@ -1888,7 +1888,7 @@ ql_enqueue_aen(ql_adapter_state_t *ha, uint16_t event_code, void *payload) } aen_queue = (EXT_ASYNC_EVENT *)xp->aen_tracking_queue; - if (aen_queue[xp->aen_q_tail].AsyncEventCode != NULL) { + if (aen_queue[xp->aen_q_tail].AsyncEventCode != 0) { /* Need to change queue pointers to make room. */ /* Increment tail for adding new entry. */ @@ -6525,7 +6525,7 @@ ql_setup_fcache(ql_adapter_state_t *ha) * * Input: * ha = adapter state pointer. - * *bpf = Pointer to flash buffer. + * *bpf = Pointer to flash buffer. * bsize = Size of flash buffer. * * Returns: diff --git a/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_api.h b/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_api.h index 6695d0fdbf..0e8fc900af 100644 --- a/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_api.h +++ b/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_api.h @@ -1518,8 +1518,8 @@ typedef struct ql_adapter_state { fc_fca_tran_t *tran; uint32_t instance; int8_t *devpath; - uint32_t fru_hba_index; - uint32_t fru_port_index; + uint32_t fru_hba_index; + uint32_t fru_port_index; uint8_t adapInfo[18]; /* Adapter context */ @@ -1780,13 +1780,13 @@ typedef struct ql_adapter_state { #define CFG_FAST_TIMEOUT BIT_30 #define CFG_LR_SUPPORT BIT_31 -#define CFG_CTRL_2425 (CFG_CTRL_2422 | CFG_CTRL_25XX) -#define CFG_CTRL_8081 (CFG_CTRL_8021 | CFG_CTRL_81XX) -#define CFG_CTRL_2581 (CFG_CTRL_25XX | CFG_CTRL_81XX) +#define CFG_CTRL_2425 (CFG_CTRL_2422 | CFG_CTRL_25XX) +#define CFG_CTRL_8081 (CFG_CTRL_8021 | CFG_CTRL_81XX) +#define CFG_CTRL_2581 (CFG_CTRL_25XX | CFG_CTRL_81XX) #define CFG_CTRL_242581 (CFG_CTRL_2422 | CFG_CTRL_25XX | CFG_CTRL_81XX) #define CFG_CTRL_24258081 (CFG_CTRL_2425 | CFG_CTRL_8081) -#define CFG_CTRL_258081 (CFG_CTRL_25XX | CFG_CTRL_8081) -#define CFG_CTRL_2480 (CFG_CTRL_2422 | CFG_CTRL_8021) +#define CFG_CTRL_258081 (CFG_CTRL_25XX | CFG_CTRL_8081) +#define CFG_CTRL_2480 (CFG_CTRL_2422 | CFG_CTRL_8021) #define CFG_IST(ha, cfgflags) (ha->cfg_flags & cfgflags) @@ -2093,7 +2093,7 @@ typedef struct cmd_table_entry { {LA_ELS_FARP_REPLY, "LA_ELS_FARP_REPLY"}, \ {LA_ELS_RLS, "LA_ELS_RLS"}, \ {LA_ELS_RNID, "LA_ELS_RNID"}, \ - {NULL, NULL} \ + {0, NULL} \ } /* diff --git a/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_mbx.h b/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_mbx.h index 2d5e57d6df..948ab45279 100644 --- a/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_mbx.h +++ b/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_mbx.h @@ -888,7 +888,7 @@ int ql_toggle_interrupt(ql_adapter_state_t *, uint16_t); {MBC_PORT_RESET, "MBC_PORT_RESET"}, \ {MBC_SET_PORT_CONFIG, "MBC_SET_PORT_CONFIG"}, \ {MBC_GET_PORT_CONFIG, "MBC_GET_PORT_CONFIG"}, \ - {NULL, "Unsupported"} \ + {0, "Unsupported"} \ } #ifdef __cplusplus -- cgit v1.2.3 From 43bd9002dc964c045e1c90dfc1b08ab9fb316d41 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 13:20:56 +0200 Subject: 10754 portfs: NULL pointer errors Reviewed by: Sebastian Wiedenroth Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/common/fs/portfs/port.c | 152 ++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 77 deletions(-) diff --git a/usr/src/uts/common/fs/portfs/port.c b/usr/src/uts/common/fs/portfs/port.c index 14be8cbbae..70f773ab55 100644 --- a/usr/src/uts/common/fs/portfs/port.c +++ b/usr/src/uts/common/fs/portfs/port.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -122,58 +120,58 @@ * The second step is the triggering of events, which could be sent to a port. * Every event source implements an own method to generate events for a port: * PORT_SOURCE_AIO: - * The sigevent structure of the standard POSIX-IO functions - * was extended by an additional notification type. - * Standard notification types: - * SIGEV_NONE, SIGEV_SIGNAL and SIGEV_THREAD - * Event ports introduced now SIGEV_PORT. - * The notification type SIGEV_PORT specifies that a structure - * of type port_notify_t has to be attached to the sigev_value. - * The port_notify_t structure contains the event port file - * descriptor and a user-defined pointer. - * Internally the AIO implementation will use the kernel API - * functions to allocate an event port slot per transaction (aiocb) - * and sent the event to the port as soon as the transaction completes. - * All the events submitted per transaction are of type - * PORT_SOURCE_AIO. + * The sigevent structure of the standard POSIX-IO functions + * was extended by an additional notification type. + * Standard notification types: + * SIGEV_NONE, SIGEV_SIGNAL and SIGEV_THREAD + * Event ports introduced now SIGEV_PORT. + * The notification type SIGEV_PORT specifies that a structure + * of type port_notify_t has to be attached to the sigev_value. + * The port_notify_t structure contains the event port file + * descriptor and a user-defined pointer. + * Internally the AIO implementation will use the kernel API + * functions to allocate an event port slot per transaction (aiocb) + * and sent the event to the port as soon as the transaction completes. + * All the events submitted per transaction are of type + * PORT_SOURCE_AIO. * PORT_SOURCE_TIMER: - * The timer_create() function uses the same method as the - * PORT_SOURCE_AIO event source. It also uses the sigevent structure - * to deliver the port information. - * Internally the timer code will allocate a single event slot/struct - * per timer and it will send the timer event as soon as the timer - * fires. If the timer-fired event is not delivered to the application - * before the next period elapsed, then an overrun counter will be - * incremented. The timer event source uses a callback function to - * detect the delivery of the event to the application. At that time - * the timer callback function will update the event overrun counter. + * The timer_create() function uses the same method as the + * PORT_SOURCE_AIO event source. It also uses the sigevent structure + * to deliver the port information. + * Internally the timer code will allocate a single event slot/struct + * per timer and it will send the timer event as soon as the timer + * fires. If the timer-fired event is not delivered to the application + * before the next period elapsed, then an overrun counter will be + * incremented. The timer event source uses a callback function to + * detect the delivery of the event to the application. At that time + * the timer callback function will update the event overrun counter. * PORT_SOURCE_FD: - * This event source uses the port_associate() function to allocate - * an event slot/struct from a port. The application defines in the - * events argument of port_associate() the type of events which it is - * interested on. - * The internal pollwakeup() function is used by all the file - * systems --which are supporting the VOP_POLL() interface- to notify - * the upper layer (poll(2), devpoll(7d) and now event ports) about - * the event triggered (see valid events in poll(2)). - * The pollwakeup() function forwards the event to the layer registered - * to receive the current event. - * The port_dissociate() function can be used to free the allocated - * event slot from the port. Anyway, file descriptors deliver events - * only one time and remain deactivated until the application - * reactivates the association of a file descriptor with port_associate(). - * If an associated file descriptor is closed then the file descriptor - * will be dissociated automatically from the port. + * This event source uses the port_associate() function to allocate + * an event slot/struct from a port. The application defines in the + * events argument of port_associate() the type of events which it is + * interested on. + * The internal pollwakeup() function is used by all the file + * systems --which are supporting the VOP_POLL() interface- to notify + * the upper layer (poll(2), devpoll(7d) and now event ports) about + * the event triggered (see valid events in poll(2)). + * The pollwakeup() function forwards the event to the layer registered + * to receive the current event. + * The port_dissociate() function can be used to free the allocated + * event slot from the port. Anyway, file descriptors deliver events + * only one time and remain deactivated until the application + * reactivates the association of a file descriptor with port_associate(). + * If an associated file descriptor is closed then the file descriptor + * will be dissociated automatically from the port. * * PORT_SOURCE_ALERT: - * This event type is generated when the port was previously set in - * alert mode using the port_alert() function. - * A single alert event is delivered to every thread which tries to - * retrieve events from a port. + * This event type is generated when the port was previously set in + * alert mode using the port_alert() function. + * A single alert event is delivered to every thread which tries to + * retrieve events from a port. * PORT_SOURCE_USER: - * This type of event is generated from user level using the port_send() - * function to send a user event to a port or the port_sendn() function - * to send an event to a list of ports. + * This type of event is generated from user level using the port_send() + * function to send a user event to a port or the port_sendn() function + * to send an event to a list of ports. * PORT_SOURCE_FILE: * This event source uses the port_associate() interface to register * a file to be monitored for changes. The file name that needs to be @@ -207,33 +205,33 @@ * processes other than the owner of the event. * Shareable event types are: * PORT_SOURCE_USER events - * This type of event is unconditionally shareable and without - * limitations. If the parent process sends a user event and closes - * the port afterwards, the event remains in the port and the child - * process will still be able to retrieve the user event. + * This type of event is unconditionally shareable and without + * limitations. If the parent process sends a user event and closes + * the port afterwards, the event remains in the port and the child + * process will still be able to retrieve the user event. * PORT_SOURCE_ALERT events - * This type of event is shareable between processes. - * Limitation: The alert mode of the port is removed if the owner - * (process which set the port in alert mode) of the - * alert event closes the port. + * This type of event is shareable between processes. + * Limitation: The alert mode of the port is removed if the owner + * (process which set the port in alert mode) of the + * alert event closes the port. * PORT_SOURCE_FD events - * This type of event is conditional shareable between processes. - * After fork(2) all forked file descriptors are shareable between - * the processes. The child process is allowed to retrieve events - * from the associated file descriptors and it can also re-associate - * the fd with the port. - * Limitations: The child process is not allowed to dissociate - * the file descriptor from the port. Only the - * owner (process) of the association is allowed to - * dissociate the file descriptor from the port. - * If the owner of the association closes the port - * the association will be removed. + * This type of event is conditional shareable between processes. + * After fork(2) all forked file descriptors are shareable between + * the processes. The child process is allowed to retrieve events + * from the associated file descriptors and it can also re-associate + * the fd with the port. + * Limitations: The child process is not allowed to dissociate + * the file descriptor from the port. Only the + * owner (process) of the association is allowed to + * dissociate the file descriptor from the port. + * If the owner of the association closes the port + * the association will be removed. * PORT_SOURCE_AIO events - * This type of event is not shareable between processes. + * This type of event is not shareable between processes. * PORT_SOURCE_TIMER events - * This type of event is not shareable between processes. + * This type of event is not shareable between processes. * PORT_SOURCE_FILE events - * This type of event is not shareable between processes. + * This type of event is not shareable between processes. * * FORK BEHAVIOUR * On fork(2) the child process inherits all opened file descriptors from @@ -478,7 +476,7 @@ _init(void) extern const fs_operation_def_t port_vnodeops_template[]; vfsops_t *port_vfsops; int error; - major_t major; + major_t major; if ((major = getudev()) == (major_t)-1) return (ENXIO); @@ -556,7 +554,7 @@ portfs(int opcode, uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, { rval_t r; port_t *pp; - int error = 0; + int error = 0; uint_t nget; file_t *fp; port_gettimer_t port_timer; @@ -601,7 +599,7 @@ portfs(int opcode, uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, port_timer.pgt_flags = PORTGET_ONE; port_timer.pgt_loop = 0; port_timer.pgt_rqtp = NULL; - if (a4 != NULL) { + if (a4 != 0) { port_timer.pgt_timeout = &timeout; timeout.tv_sec = (time_t)a2; timeout.tv_nsec = (long)a3; @@ -1160,8 +1158,8 @@ port_getn(port_t *pp, port_event_t *uevp, uint_t max, uint_t *nget, port_gettimer_t *pgt) { port_queue_t *portq; - port_kevent_t *pev; - port_kevent_t *lev; + port_kevent_t *pev; + port_kevent_t *lev; int error = 0; uint_t nmax; uint_t nevents; @@ -1765,7 +1763,7 @@ port_get_timeout(timespec_t *timeout, timespec_t *rqtime, timespec_t **rqtp, return (EFAULT); #ifdef _SYSCALL32_IMPL } else { - timespec32_t wait_time_32; + timespec32_t wait_time_32; if (copyin(timeout, &wait_time_32, sizeof (wait_time_32))) return (EFAULT); -- cgit v1.2.3 From e14e15a6cbf868bfce31e7f485294c3358f1ae2a Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 13:23:12 +0200 Subject: 10756 kaio: NULL pointer errors Reviewed by: Marcel Telka Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/common/os/aio.c | 61 ++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/usr/src/uts/common/os/aio.c b/usr/src/uts/common/os/aio.c index 35e0a4dd63..38f549c096 100644 --- a/usr/src/uts/common/os/aio.c +++ b/usr/src/uts/common/os/aio.c @@ -416,7 +416,7 @@ aionotify(void) static int timeval2reltime(struct timeval *timout, timestruc_t *rqtime, - timestruc_t **rqtp, int *blocking) + timestruc_t **rqtp, int *blocking) { #ifdef _SYSCALL32_IMPL struct timeval32 wait_time_32; @@ -479,7 +479,7 @@ timeval2reltime(struct timeval *timout, timestruc_t *rqtime, static int timespec2reltime(timespec_t *timout, timestruc_t *rqtime, - timestruc_t **rqtp, int *blocking) + timestruc_t **rqtp, int *blocking) { #ifdef _SYSCALL32_IMPL timespec32_t wait_time_32; @@ -521,12 +521,9 @@ timespec2reltime(timespec_t *timout, timestruc_t *rqtime, /*ARGSUSED*/ static int -aiowait( - struct timeval *timout, - int dontblockflg, - long *rval) +aiowait(struct timeval *timout, int dontblockflg, long *rval) { - int error; + int error; aio_t *aiop; aio_req_t *reqp; clock_t status; @@ -611,7 +608,7 @@ aiowait( static int aiowaitn(void *uiocb, uint_t nent, uint_t *nwait, timespec_t *timout) { - int error = 0; + int error = 0; aio_t *aiop; aio_req_t *reqlist = NULL; caddr_t iocblist = NULL; /* array of iocb ptr's */ @@ -894,15 +891,10 @@ aio_reqlist_concat(aio_t *aiop, aio_req_t **reqlist, int max) /*ARGSUSED*/ static int -aiosuspend( - void *aiocb, - int nent, - struct timespec *timout, - int flag, - long *rval, - int run_mode) +aiosuspend(void *aiocb, int nent, struct timespec *timout, int flag, + long *rval, int run_mode) { - int error; + int error; aio_t *aiop; aio_req_t *reqp, *found, *next; caddr_t cbplist = NULL; @@ -1157,7 +1149,7 @@ aiostart(void) static int aio_req_assoc_port_rw(port_notify_t *pntfy, aiocb_t *cbp, - aio_req_t *reqp, int event) + aio_req_t *reqp, int event) { port_kevent_t *pkevp = NULL; int error; @@ -1679,8 +1671,8 @@ aio_list_get(aio_result_t *resultp) { aio_lio_t *head = NULL; aio_t *aiop; - aio_req_t **bucket; - aio_req_t *reqp; + aio_req_t **bucket; + aio_req_t *reqp; long index; aiop = curproc->p_aio; @@ -1754,7 +1746,7 @@ alio_cleanup(aio_t *aiop, aiocb_t **cbp, int nent, int run_mode) caddr32_t *cbp32; cbp32 = (caddr32_t *)cbp; - if (cbp32[i] == NULL) + if (cbp32[i] == 0) continue; if (run_mode == AIO_32) { aiocb_32 = (aiocb32_t *)(uintptr_t)cbp32[i]; @@ -1842,17 +1834,13 @@ aioerror(void *cb, int run_mode) } /* - * aio_cancel - if no requests outstanding, + * aio_cancel - if no requests outstanding, * return AIO_ALLDONE * else * return AIO_NOTCANCELED */ static int -aio_cancel( - int fildes, - void *cb, - long *rval, - int run_mode) +aio_cancel(int fildes, void *cb, long *rval, int run_mode) { aio_t *aiop; void *resultp; @@ -2392,17 +2380,12 @@ aio_req_remove(aio_req_t *reqp) } static int -aio_req_setup( - aio_req_t **reqpp, - aio_t *aiop, - aiocb_t *arg, - aio_result_t *resultp, - vnode_t *vp, - int old_solaris_req) +aio_req_setup(aio_req_t **reqpp, aio_t *aiop, aiocb_t *arg, + aio_result_t *resultp, vnode_t *vp, int old_solaris_req) { sigqueue_t *sqp = NULL; - aio_req_t *reqp; - struct uio *uio; + aio_req_t *reqp; + struct uio *uio; struct sigevent *sigev; int error; @@ -2776,7 +2759,7 @@ static int { struct snode *sp; dev_t dev; - struct cb_ops *cb; + struct cb_ops *cb; major_t major; int (*aio_func)(); @@ -2854,7 +2837,7 @@ static int driver_aio_write(vnode_t *vp, struct aio_req *aio, cred_t *cred_p) { dev_t dev; - struct cb_ops *cb; + struct cb_ops *cb; ASSERT(vp->v_type == VCHR); ASSERT(!IS_PXFSVP(vp)); @@ -2878,7 +2861,7 @@ static int driver_aio_read(vnode_t *vp, struct aio_req *aio, cred_t *cred_p) { dev_t dev; - struct cb_ops *cb; + struct cb_ops *cb; ASSERT(vp->v_type == VCHR); ASSERT(!IS_PXFSVP(vp)); @@ -3301,7 +3284,7 @@ aio_req_setupLF( aio_req_t *reqp; struct uio *uio; struct sigevent32 *sigev; - int error; + int error; sigev = &arg->aio_sigevent; if (sigev->sigev_notify == SIGEV_SIGNAL && -- cgit v1.2.3 From 1d775d5906fd85b9ab1ac2251af8d38b5567d9a1 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Fri, 19 Apr 2019 15:59:25 +0300 Subject: 10829 zpool-features.5 add missing .RE Reviewed by: Andy Stormont Reviewed by: Peter Tribble Reviewed by: Gergő Doma Approved by: Dan McDonald MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/src/man/man5/zpool-features.5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/src/man/man5/zpool-features.5 b/usr/src/man/man5/zpool-features.5 index 2823b764c3..3f83366f0e 100644 --- a/usr/src/man/man5/zpool-features.5 +++ b/usr/src/man/man5/zpool-features.5 @@ -15,7 +15,7 @@ .\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your .\" own identifying information: .\" Portions Copyright [yyyy] [name of copyright owner] -.TH ZPOOL-FEATURES 5 "Jun 8, 2018" +.TH ZPOOL-FEATURES 5 "Apr 19, 2019" .SH NAME zpool\-features \- ZFS pool feature descriptions .SH DESCRIPTION @@ -661,6 +661,8 @@ ever had their checksum set to \fBedonr\fR are destroyed. Booting off of pools using \fBedonr\fR is supported. +.RE + .sp .ne 2 .na @@ -681,7 +683,5 @@ This feature becomes \fBactive\fR when a dedicated allocation class vdev removal, it can be returned to the \fBenabled\fR state if all the top-level vdevs from an allocation class are removed. -.RE - .SH "SEE ALSO" \fBzfs\fR(1M), \fBzpool\fR(1M) -- cgit v1.2.3 From a8eee26afa7ddf0c604c989c598251014bdc6e6f Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 10:46:49 +0200 Subject: 10745 rlmod: NULL pointer errors Reviewed by: Sebastian Wiedenroth Approved by: Dan McDonald --- usr/src/uts/common/io/rlmod.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/usr/src/uts/common/io/rlmod.c b/usr/src/uts/common/io/rlmod.c index 2208656adf..145c300323 100644 --- a/usr/src/uts/common/io/rlmod.c +++ b/usr/src/uts/common/io/rlmod.c @@ -25,8 +25,6 @@ * Copyright (c) 2016 by Delphix. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This module implements the services provided by the rlogin daemon * after the connection is set up. Mainly this means responding to @@ -111,7 +109,7 @@ static int rlmodwput(queue_t *, mblk_t *); static int rlmodwsrv(queue_t *); static int rlmodrmsg(queue_t *, mblk_t *); static mblk_t *make_expmblk(char); -static int rlwinctl(queue_t *, mblk_t *); +static int rlwinctl(queue_t *, mblk_t *); static mblk_t *rlwinsetup(queue_t *, mblk_t *, unsigned char *); static void rlmod_timer(void *); @@ -377,9 +375,9 @@ rlmodrput(queue_t *q, mblk_t *mp) if ((mp->b_datap->db_type < QPCTL) && /* ...and data is already queued... */ ((q->q_first) || - /* ...or currently disabled and this is M_DATA... */ - ((rmip->flags & RL_DISABLED) && - (mp->b_datap->db_type == M_DATA)))) { + /* ...or currently disabled and this is M_DATA... */ + ((rmip->flags & RL_DISABLED) && + (mp->b_datap->db_type == M_DATA)))) { /* ...delay delivery of the message */ (void) putq(q, mp); TRACE_3(TR_FAC_RLOGINP, TR_RLOGINP_RPUT_OUT, @@ -475,7 +473,7 @@ rlmodrput(queue_t *q, mblk_t *mp) freemsg(mp); } TRACE_3(TR_FAC_RLOGINP, TR_RLOGINP_RPUT_OUT, "rlmodrput end: q %p, " - "mp %p, %s", q, mp, "done"); + "mp %p, %s", q, mp, "done"); return (0); } @@ -498,8 +496,8 @@ rlmodrsrv(queue_t *q) if (rmip->flags & RL_DISABLED) { (void) putbq(q, mp); TRACE_3(TR_FAC_RLOGINP, TR_RLOGINP_RSRV_OUT, - "rlmodrsrv end: q %p, mp %p, %s", q, mp, - "disabled"); + "rlmodrsrv end: q %p, mp %p, %s", q, mp, + "disabled"); return (0); } if (!canputnext(q)) { @@ -888,7 +886,7 @@ rlmodrmsg(queue_t *q, mblk_t *mp) if ((pullupmsg(newmp, -1)) == 0) { sz = msgdsize(newmp); recover(q, newmp, sz); - return (NULL); + return (0); } /* * pullupmsg results in newmp consuming @@ -944,7 +942,7 @@ rlmodrmsg(queue_t *q, mblk_t *mp) if (rlwinsetup(q, mp, tmp) == NULL) { sz = msgdsize(mp); recover(q, mp, sz); - return (NULL); + return (0); } /* * We have successfully consumed the @@ -978,7 +976,7 @@ out: if (newmp) { if (!canputnext(q)) { (void) putbq(q, newmp); - return (NULL); + return (0); } else { putnext(q, newmp); } @@ -1054,7 +1052,7 @@ rlwinsetup(queue_t *q, mblk_t *mp, unsigned char *blk) win.ws_ypixel = ntohs(win.ws_ypixel); bcopy(&win, mp1->b_rptr, sizeof (struct winsize)); - if ((rlwinctl(q, mp1)) == NULL) { + if ((rlwinctl(q, mp1)) == 0) { freeb(mp1); return (0); } @@ -1143,7 +1141,7 @@ tty_flow(queue_t *q, struct rlmod_info *rmip, mblk_t *mp) * If tty ioctl processing is done, check for stopmode */ stop = (ixon && (rmip->stopc == CTRL('s')) && - (rmip->startc == CTRL('q'))); + (rmip->startc == CTRL('q'))); if (rmip->stopmode == TIOCPKT_NOSTOP) { if (stop) { cntl = rmip->oobdata[0] | TIOCPKT_DOSTOP; @@ -1249,7 +1247,7 @@ rlmodwioctl(queue_t *q, mblk_t *mp) else rmip->flags &= ~RL_IOCPASSTHRU; - miocack(q, mp, NULL, 0); + miocack(q, mp, 0, 0); break; default: @@ -1258,8 +1256,8 @@ rlmodwioctl(queue_t *q, mblk_t *mp) } else { #ifdef DEBUG cmn_err(CE_NOTE, - "rlmodwioctl: unexpected ioctl type 0x%x", - ioc->ioc_cmd); + "rlmodwioctl: unexpected ioctl type 0x%x", + ioc->ioc_cmd); #endif miocnak(q, mp, 0, EINVAL); } -- cgit v1.2.3 From 0f48f68d9e0ad95b0edf718f68736cf3635a1f79 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 13:26:57 +0200 Subject: 10758 c2audit: NULL pointer errors Reviewed by: Andy Stormont Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/common/c2/audit.c | 10 +++---- usr/src/uts/common/c2/audit_event.c | 54 ++++++++++++++----------------------- usr/src/uts/common/c2/audit_io.c | 12 ++++----- usr/src/uts/common/c2/audit_start.c | 2 +- 4 files changed, 32 insertions(+), 46 deletions(-) diff --git a/usr/src/uts/common/c2/audit.c b/usr/src/uts/common/c2/audit.c index 9084cd6d19..0553cca7b2 100644 --- a/usr/src/uts/common/c2/audit.c +++ b/usr/src/uts/common/c2/audit.c @@ -411,7 +411,7 @@ audit_symlink(struct pathname *pnp, struct pathname *sympath) * the specified file/directory attr) should be audited or * ignored. * - * returns: 1 - if audit policy and object attributes indicate that + * returns: 1 - if audit policy and object attributes indicate that * file/directory is effectively public. read events for * the file should not be audited. * 0 - otherwise @@ -526,7 +526,7 @@ audit_exit(int code, int what) /* * ROUTINE: AUDIT_CORE_START * PURPOSE: - * CALLBY: PSIG + * CALLBY: PSIG * NOTE: * TODO: */ @@ -928,7 +928,7 @@ audit_ipcget(int type, void *vp) return; switch (type) { - case NULL: + case 0: au_uwrite(au_to_ipc_perm((struct kipc_perm *)vp)); break; case AT_IPC_MSG: @@ -1298,7 +1298,7 @@ audit_enterprom(int flg) else au_write((caddr_t *)&(rp), au_to_return32(ECANCELED, 0)); - AUDIT_ASYNC_FINISH(rp, AUE_ENTERPROM, NULL, NULL); + AUDIT_ASYNC_FINISH(rp, AUE_ENTERPROM, 0, NULL); } @@ -1331,7 +1331,7 @@ audit_exitprom(int flg) else au_write((caddr_t *)&(rp), au_to_return32(ECANCELED, 0)); - AUDIT_ASYNC_FINISH(rp, AUE_EXITPROM, NULL, NULL); + AUDIT_ASYNC_FINISH(rp, AUE_EXITPROM, 0, NULL); } struct fcntla { diff --git a/usr/src/uts/common/c2/audit_event.c b/usr/src/uts/common/c2/audit_event.c index cb75b17e3c..1cb523121f 100644 --- a/usr/src/uts/common/c2/audit_event.c +++ b/usr/src/uts/common/c2/audit_event.c @@ -195,7 +195,7 @@ static void aus_socket(struct t_audit_data *); struct audit_s2e audit_s2e[] = { /* - * ---------- ---------- ---------- ---------- + * ---------- ---------- ---------- ---------- * INITIAL AUDIT START SYSTEM * PROCESSING EVENT PROCESSING CALL * ---------- ---------- ---------- ----------- @@ -866,7 +866,7 @@ aui_fchownat(au_event_t e) long flags; } *uap = (struct a *)clwp->lwp_ap; - if (uap->fname == NULL) + if (uap->fname == 0) e = AUE_FCHOWN; else if (uap->flags & AT_SYMLINK_NOFOLLOW) e = AUE_LCHOWN; @@ -969,7 +969,7 @@ aui_fchmodat(au_event_t e) long flag; } *uap = (struct a *)clwp->lwp_ap; - if (uap->fname == NULL) + if (uap->fname == 0) e = AUE_FCHMOD; else e = AUE_CHMOD; @@ -1000,7 +1000,7 @@ aus_fchmodat(struct t_audit_data *tad) au_uwrite(au_to_arg32(2, "new file mode", fmode&07777)); - if (fd == AT_FDCWD || uap->fname != NULL) /* same as chmod() */ + if (fd == AT_FDCWD || uap->fname != 0) /* same as chmod() */ return; /* @@ -1200,7 +1200,7 @@ aui_fstatat(au_event_t e) long flags; } *uap = (struct a *)clwp->lwp_ap; - if (uap->fnamep == NULL) + if (uap->fnamep == 0) e = AUE_FSTAT; else if (uap->flags & AT_SYMLINK_NOFOLLOW) e = AUE_LSTAT; @@ -1714,7 +1714,8 @@ auf_mknodat(struct t_audit_data *tad, int error, rval_t *rval) /*ARGSUSED*/ static void aus_mount(struct t_audit_data *tad) -{ /* AUS_START */ +{ + /* AUS_START */ klwp_t *clwp = ttolwp(curthread); uint32_t flags; uintptr_t u_fstype, dataptr; @@ -1747,21 +1748,19 @@ aus_mount(struct t_audit_data *tad) STRUCT_INIT(nfsargs, get_udatamodel()); bzero(STRUCT_BUF(nfsargs), STRUCT_SIZE(nfsargs)); - if (copyin((caddr_t)dataptr, - STRUCT_BUF(nfsargs), - MIN(uap->datalen, STRUCT_SIZE(nfsargs)))) { + if (copyin((caddr_t)dataptr, STRUCT_BUF(nfsargs), + MIN(uap->datalen, STRUCT_SIZE(nfsargs)))) { /* DEBUG debug_enter((char *)NULL); */ goto mount_free_fstype; } hostname = kmem_alloc(MAXNAMELEN, KM_SLEEP); if (copyinstr(STRUCT_FGETP(nfsargs, hostname), - (caddr_t)hostname, - MAXNAMELEN, &len)) { + (caddr_t)hostname, MAXNAMELEN, &len)) { goto mount_free_hostname; } au_uwrite(au_to_text(hostname)); au_uwrite(au_to_arg32(3, "internal flags", - (uint_t)STRUCT_FGET(nfsargs, flags))); + (uint_t)STRUCT_FGET(nfsargs, flags))); mount_free_hostname: kmem_free(hostname, MAXNAMELEN); @@ -2080,7 +2079,7 @@ aui_setpgrp(au_event_t e) case 0: /* getpgrp() - not security relevant */ case 2: /* getsid() - not security relevant */ - case 4: /* getpgid() - not security relevant */ + case 4: /* getpgid() - not security relevant */ e = AUE_NULL; break; @@ -3748,7 +3747,7 @@ auf_connect(struct t_audit_data *tad, int error, rval_t *rval) (void) socket_getsockname(so, (struct sockaddr *)so_laddr, &len, CRED()); if (error) { - if (uap->addr == NULL) + if (uap->addr == 0) break; if (uap->len <= 0) break; @@ -3998,8 +3997,7 @@ auf_setsockopt(struct t_audit_data *tad, int error, rval_t *rval) /*ARGSUSED*/ static void -aus_sockconfig(tad) - struct t_audit_data *tad; +aus_sockconfig(struct t_audit_data *tad) { struct a { long cmd; @@ -4342,7 +4340,7 @@ auf_recvfrom( bzero((void *)so_faddr, sizeof (so_faddr)); /* sanity check */ - if (uap->from == NULL) + if (uap->from == 0) break; /* sanity checks */ @@ -4730,7 +4728,7 @@ auf_sendto(struct t_audit_data *tad, int error, rval_t *rval) /* get peer address */ /* sanity check */ - if (uap->to == NULL) + if (uap->to == 0) break; /* sanity checks */ @@ -5427,10 +5425,7 @@ aus_facl(struct t_audit_data *tad) /*ARGSUSED*/ static void -auf_read(tad, error, rval) - struct t_audit_data *tad; - int error; - rval_t *rval; +auf_read(struct t_audit_data *tad, int error, rval_t *rval) { struct file *fp; struct f_audit_data *fad; @@ -5484,10 +5479,7 @@ auf_read(tad, error, rval) /*ARGSUSED*/ static void -auf_write(tad, error, rval) - struct t_audit_data *tad; - int error; - rval_t *rval; +auf_write(struct t_audit_data *tad, int error, rval_t *rval) { struct file *fp; struct f_audit_data *fad; @@ -5541,10 +5533,7 @@ auf_write(tad, error, rval) /*ARGSUSED*/ static void -auf_recv(tad, error, rval) - struct t_audit_data *tad; - int error; - rval_t *rval; +auf_recv(struct t_audit_data *tad, int error, rval_t *rval) { struct sonode *so; char so_laddr[sizeof (struct sockaddr_in6)]; @@ -5675,10 +5664,7 @@ auf_recv(tad, error, rval) /*ARGSUSED*/ static void -auf_send(tad, error, rval) - struct t_audit_data *tad; - int error; - rval_t *rval; +auf_send(struct t_audit_data *tad, int error, rval_t *rval) { struct sonode *so; char so_laddr[sizeof (struct sockaddr_in6)]; diff --git a/usr/src/uts/common/c2/audit_io.c b/usr/src/uts/common/c2/audit_io.c index 54624e791c..8d109e483e 100644 --- a/usr/src/uts/common/c2/audit_io.c +++ b/usr/src/uts/common/c2/audit_io.c @@ -72,8 +72,7 @@ static int state_if_not_part[] = { * Add the au_membuf to the descriptor chain and free the chain passed in. */ void -au_uwrite(m) - token_t *m; +au_uwrite(token_t *m) { au_write(&(u_ad), m); } @@ -231,9 +230,9 @@ void au_close_time(au_kcontext_t *kctx, token_t *dchain, int flag, au_event_t e_type, au_emod_t e_mod, timestruc_t *etime) { - token_t *record; /* au_membuf chain == the record */ + token_t *record; /* au_membuf chain == the record */ int byte_count; - token_t *m; /* for potential sequence token */ + token_t *m; /* for potential sequence token */ adr_t hadr; /* handle for header token */ adr_t sadr; /* handle for sequence token */ size_t zone_length; /* length of zonename token */ @@ -616,7 +615,8 @@ au_doormsg(au_kcontext_t *kctx, uint32_t message_code, void *message) * records in buffers of up to auk_queue.buflen in size. */ int -au_doorio(au_kcontext_t *kctx) { +au_doorio(au_kcontext_t *kctx) +{ off_t off; /* space used in buffer */ ssize_t used; /* space used in au_membuf */ token_t *cAR; /* current AR being processed */ @@ -812,7 +812,7 @@ audit_async_start(label_t *jb, au_event_t event, int sorf) if (sorf & AUM_FAIL) failure = kctx->auk_info.ai_namask.as_failure & estate; - if ((success | failure) == NULL) + if ((success | failure) == 0) return (1); ASSERT(tad->tad_errjmp == NULL); diff --git a/usr/src/uts/common/c2/audit_start.c b/usr/src/uts/common/c2/audit_start.c index 1f31d7dec9..49713c6f77 100644 --- a/usr/src/uts/common/c2/audit_start.c +++ b/usr/src/uts/common/c2/audit_start.c @@ -106,7 +106,7 @@ audit_init_module() /* generate a system-booted audit record */ au_write((caddr_t *)&rp, au_to_text("booting kernel")); - audit_async_finish((caddr_t *)&rp, AUE_SYSTEMBOOT, NULL, + audit_async_finish((caddr_t *)&rp, AUE_SYSTEMBOOT, 0, &(p0.p_user.u_start)); } -- cgit v1.2.3 From 239936d2b877f13d716270a06e56203231806b36 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 13:43:53 +0200 Subject: 10762 hidparser: NULL pointer errors Reviewed by: Andy Stormont Approved by: Dan McDonald --- .../common/io/usb/clients/hidparser/hidparser.c | 144 +++++++-------------- 1 file changed, 46 insertions(+), 98 deletions(-) diff --git a/usr/src/uts/common/io/usb/clients/hidparser/hidparser.c b/usr/src/uts/common/io/usb/clients/hidparser/hidparser.c index a830ff1c65..f06c572779 100644 --- a/usr/src/uts/common/io/usb/clients/hidparser/hidparser.c +++ b/usr/src/uts/common/io/usb/clients/hidparser/hidparser.c @@ -215,11 +215,8 @@ static hidparser_terminal_t *hid_first_list[] = { * Calls the main parser routine */ int -hidparser_parse_report_descriptor( - unsigned char *descriptor, - size_t size, - usb_hid_descr_t *hid_descriptor, - hidparser_handle_t *parse_handle) +hidparser_parse_report_descriptor(unsigned char *descriptor, size_t size, + usb_hid_descr_t *hid_descriptor, hidparser_handle_t *parse_handle) { int error = 0; entity_item_t *root; @@ -269,7 +266,7 @@ hidparser_free_report_descriptor_handle(hidparser_handle_t parse_handle) */ int hidparser_get_country_code(hidparser_handle_t parser_handle, - uint16_t *country_code) + uint16_t *country_code) { if ((parser_handle == NULL) || (parser_handle->hidparser_handle_hid_descr == NULL)) { @@ -291,9 +288,7 @@ hidparser_get_country_code(hidparser_handle_t parser_handle, */ int hidparser_get_packet_size(hidparser_handle_t parser_handle, - uint_t report_id, - uint_t main_item_type, - uint_t *size) + uint_t report_id, uint_t main_item_type, uint_t *size) { if ((parser_handle == NULL) || (parser_handle-> hidparser_handle_parse_tree == NULL)) { @@ -316,14 +311,12 @@ hidparser_get_packet_size(hidparser_handle_t parser_handle, */ int hidparser_get_packet_size_report_des(entity_item_t *parser_handle, - uint32_t report_id, - uint32_t main_item_type, - uint32_t *size) + uint32_t report_id, uint32_t main_item_type, uint32_t *size) { entity_item_t *current = parser_handle; entity_attribute_t *attribute; - uint32_t temp; - uchar_t foundsize, foundcount, foundreportid, right_report_id; + uint32_t temp; + uchar_t foundsize, foundcount, foundreportid, right_report_id; foundsize = 0; foundcount = 0; @@ -402,12 +395,8 @@ hidparser_get_packet_size_report_des(entity_item_t *parser_handle, */ int hidparser_get_usage_attribute(hidparser_handle_t parser_handle, - uint_t report_id, - uint_t main_item_type, - uint_t usage_page, - uint_t usage_id, - uint_t usage_attribute, - int *usage_attribute_value) + uint_t report_id, uint_t main_item_type, uint_t usage_page, + uint_t usage_id, uint_t usage_attribute, int *usage_attribute_value) { return (hidparser_get_usage_attribute_report_des( @@ -423,13 +412,8 @@ hidparser_get_usage_attribute(hidparser_handle_t parser_handle, */ static int hidparser_get_usage_attribute_report_des(entity_item_t *parser_handle, - uint_t report_id, - uint_t main_item_type, - uint_t usage_page, - uint_t usage_id, - uint_t usage_attribute, - int *usage_attribute_value) - + uint_t report_id, uint_t main_item_type, uint_t usage_page, + uint_t usage_id, uint_t usage_attribute, int *usage_attribute_value) { entity_item_t *current = parser_handle; entity_attribute_t *attribute; @@ -524,7 +508,7 @@ hidparser_get_usage_attribute_report_des(entity_item_t *parser_handle, /* Match attribute */ found_ret_value = 1; *usage_attribute_value = - attribute->entity_attribute_value[0]; + *attribute->entity_attribute_value; if (attribute-> entity_attribute_length == 2) { attvalue = @@ -587,11 +571,8 @@ hidparser_get_usage_attribute_report_des(entity_item_t *parser_handle, */ int hidparser_get_main_item_data_descr(hidparser_handle_t parser_handle, - uint_t report_id, - uint_t main_item_type, - uint_t usage_page, - uint_t usage_id, - uint_t *main_item_descr_value) + uint_t report_id, uint_t main_item_type, uint_t usage_page, + uint_t usage_id, uint_t *main_item_descr_value) { return hidparser_get_main_item_data_descr_main( @@ -607,11 +588,8 @@ hidparser_get_main_item_data_descr(hidparser_handle_t parser_handle, */ static int hidparser_get_main_item_data_descr_main(entity_item_t *parser_handle, - uint_t report_id, - uint_t main_item_type, - uint_t usage_page, - uint_t usage_id, - uint_t *main_item_descr_value) + uint_t report_id, uint_t main_item_type, uint_t usage_page, + uint_t usage_id, uint_t *main_item_descr_value) { entity_item_t *current = parser_handle; entity_attribute_t *attribute; @@ -731,7 +709,7 @@ hidparser_get_main_item_data_descr_main(entity_item_t *parser_handle, } } - *main_item_descr_value = (uint_t)NULL; + *main_item_descr_value = 0; return (HIDPARSER_NOT_FOUND); } @@ -742,8 +720,7 @@ hidparser_get_main_item_data_descr_main(entity_item_t *parser_handle, */ int hidparser_lookup_usage_collection(hidparser_handle_t parse_handle, - uint_t lusage_page, - uint_t lusage_id) + uint_t lusage_page, uint_t lusage_id) { entity_item_t *current; entity_attribute_t *attribute; @@ -812,8 +789,7 @@ check_usage: */ int hidparser_get_top_level_collection_usage(hidparser_handle_t parse_handle, - uint_t *usage_page, - uint_t *usage_id) + uint_t *usage_page, uint_t *usage_id) { entity_item_t *current; entity_attribute_t *attribute; @@ -887,9 +863,7 @@ hidparser_get_top_level_collection_usage(hidparser_handle_t parse_handle, */ int hidparser_get_usage_list_in_order(hidparser_handle_t parser_handle, - uint_t report_id, - uint_t main_item_type, - hidparser_rpt_t *rpt) + uint_t report_id, uint_t main_item_type, hidparser_rpt_t *rpt) { if ((parser_handle == NULL) || @@ -908,10 +882,8 @@ hidparser_get_usage_list_in_order(hidparser_handle_t parser_handle, static int hidparser_get_usage_list_in_order_internal(entity_item_t *parser_handle, - uint_t collection_usage, - uint_t report_id, - uint_t main_item_type, - hidparser_rpt_t *rpt) + uint_t collection_usage, uint_t report_id, uint_t main_item_type, + hidparser_rpt_t *rpt) { /* setup wrapper function */ @@ -1166,7 +1138,7 @@ hidparser_get_usage_list_in_order_internal(entity_item_t *parser_handle, */ static void hidparser_fill_usage_info(hidparser_usage_info_t *ui, - entity_attribute_t *attribute) + entity_attribute_t *attribute) { bzero(ui, sizeof (*ui)); @@ -1219,8 +1191,7 @@ hidparser_fill_usage_info(hidparser_usage_info_t *ui, */ int hidparser_get_report_id_list(hidparser_handle_t parser_handle, - uint_t main_item_type, - hidparser_report_id_list_t *report_id_list) + uint_t main_item_type, hidparser_report_id_list_t *report_id_list) { if ((parser_handle == NULL) || @@ -1242,10 +1213,8 @@ hidparser_get_report_id_list(hidparser_handle_t parser_handle, * internal function that generates list of all report ids */ int -hidparser_get_report_id_list_internal( - entity_item_t *parser_handle, - uint_t main_item_type, - hidparser_report_id_list_t *id_lst) +hidparser_get_report_id_list_internal(entity_item_t *parser_handle, + uint_t main_item_type, hidparser_report_id_list_t *id_lst) { /* setup wrapper function */ entity_item_t *current = parser_handle; @@ -1324,8 +1293,7 @@ hidparser_get_report_id_list_internal( * being called. */ static int -hidparser_print_report_descr_handle(entity_item_t *handle, - int indent_level) +hidparser_print_report_descr_handle(entity_item_t *handle, int indent_level) { entity_item_t *current = handle; @@ -1383,8 +1351,7 @@ hidparser_print_entity(entity_item_t *entity, int indent_level) * Prints the attribute passed in the argument */ static void -hidparser_print_this_attribute(entity_attribute_t *attribute, - char *ident_space) +hidparser_print_this_attribute(entity_attribute_t *attribute, char *ident_space) { if (ident_space == NULL) { @@ -1458,8 +1425,7 @@ hidparser_print_this_attribute(entity_attribute_t *attribute, * that is passed through the first argument */ static int -hidparser_lookup_first(int func_index, - int token) +hidparser_lookup_first(int func_index, int token) { int *itemp; @@ -1485,9 +1451,7 @@ hidparser_lookup_first(int func_index, * to parse the Report Descriptor */ static int -hidparser_main(unsigned char *descriptor, - size_t size, - entity_item_t **item_ptr) +hidparser_main(unsigned char *descriptor, size_t size, entity_item_t **item_ptr) { hidparser_tok_t *scan_ifp; int retval; @@ -1529,8 +1493,8 @@ hidparser_main(unsigned char *descriptor, * hidparser_ReportDescriptor */ static int -hidparser_ReportDescriptorDash(entity_item_t ** item_ptr, - hidparser_tok_t *scan_ifp) +hidparser_ReportDescriptorDash(entity_item_t **item_ptr, + hidparser_tok_t *scan_ifp) { if ((hidparser_ReportDescriptor(item_ptr, scan_ifp) == @@ -1560,8 +1524,7 @@ hidparser_ReportDescriptorDash(entity_item_t ** item_ptr, * ReportDescriptor -> ItemList */ static int -hidparser_ReportDescriptor(entity_item_t ** item_ptr, - hidparser_tok_t *scan_ifp) +hidparser_ReportDescriptor(entity_item_t **item_ptr, hidparser_tok_t *scan_ifp) { hidparser_scan(scan_ifp); @@ -1615,7 +1578,7 @@ hidparser_ReportDescriptor(entity_item_t ** item_ptr, * possible values below it. */ static int -hidparser_ItemList(entity_item_t ** item_ptr, hidparser_tok_t *scan_ifp) +hidparser_ItemList(entity_item_t **item_ptr, hidparser_tok_t *scan_ifp) { entity_item_t *curr_ei, *cache_ei, *prev_ei, *tmp_ei; boolean_t root_coll = B_FALSE; @@ -1741,8 +1704,7 @@ hidparser_ItemList(entity_item_t ** item_ptr, hidparser_tok_t *scan_ifp) * | Feature */ static int -hidparser_MainItem(entity_item_t ** item_ptr, - hidparser_tok_t *scan_ifp) +hidparser_MainItem(entity_item_t **item_ptr, hidparser_tok_t *scan_ifp) { switch (scan_ifp->hidparser_tok_token) { case R_ITEM_INPUT: @@ -1839,7 +1801,7 @@ hidparser_Items(hidparser_tok_t *scan_ifp) * | ReportID */ static int -hidparser_GlobalItem(hidparser_tok_t *scan_ifp) +hidparser_GlobalItem(hidparser_tok_t *scan_ifp) { int i; @@ -2019,7 +1981,7 @@ hidparser_GlobalItem(hidparser_tok_t *scan_ifp) * | StringMaximum */ static int -hidparser_LocalItem(hidparser_tok_t *scan_ifp) +hidparser_LocalItem(hidparser_tok_t *scan_ifp) { int i; @@ -2084,7 +2046,7 @@ hidparser_LocalItem(hidparser_tok_t *scan_ifp) * Make the child and sibling of the item NULL. */ static entity_item_t * -hidparser_allocate_entity(hidparser_tok_t *scan_ifp) +hidparser_allocate_entity(hidparser_tok_t *scan_ifp) { entity_item_t *entity; entity_attribute_t *aend; @@ -2506,11 +2468,8 @@ next_item: * Ref: Hidview error check list */ static void -hidparser_report_err(int err_level, - int err_type, - int tag, - int subcode, - char *msg) +hidparser_report_err(int err_level, int err_type, int tag, int subcode, + char *msg) { unsigned int BmParserErrorCode = 0; @@ -2775,13 +2734,8 @@ hidparser_find_signed_val(entity_attribute_t *attr) * If not report the appropriate error */ static void -hidparser_check_correspondence(entity_item_t *mainitem, - int item_tag1, - int item_tag2, - int val1, - int val2, - char *str1, - char *str2) +hidparser_check_correspondence(entity_item_t *mainitem, int item_tag1, + int item_tag2, int val1, int val2, char *str1, char *str2) { entity_attribute_t *temp1, *temp2; @@ -2812,11 +2766,8 @@ hidparser_check_correspondence(entity_item_t *mainitem, * Print for warnings and errors have been taken care separately. */ static void -hidparser_check_minmax_val(entity_item_t *mainitem, - int item_tag1, - int item_tag2, - int val1, - int val2) +hidparser_check_minmax_val(entity_item_t *mainitem, int item_tag1, + int item_tag2, int val1, int val2) { entity_attribute_t *temp1, *temp2; @@ -2871,11 +2822,8 @@ hidparser_check_minmax_val(entity_item_t *mainitem, * Print for warnings and errors have been taken care separately. */ static void -hidparser_check_minmax_val_signed(entity_item_t *mainitem, - int item_tag1, - int item_tag2, - int val1, - int val2) +hidparser_check_minmax_val_signed(entity_item_t *mainitem, int item_tag1, + int item_tag2, int val1, int val2) { entity_attribute_t *temp1, *temp2; -- cgit v1.2.3 From ee4417888cf835db6efb1e9b8039c90f0674e1cd Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 13:51:57 +0200 Subject: 10765 acpica: NULL pointer errors Reviewed by: Andy Stormont Approved by: Dan McDonald --- usr/src/uts/intel/io/acpica/osl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/src/uts/intel/io/acpica/osl.c b/usr/src/uts/intel/io/acpica/osl.c index ccaf746d1f..a9d32b281d 100644 --- a/usr/src/uts/intel/io/acpica/osl.c +++ b/usr/src/uts/intel/io/acpica/osl.c @@ -230,10 +230,10 @@ AcpiOsGetRootPointer() * in the acpi-root-tab property. */ Address = ddi_prop_get_int64(DDI_DEV_T_ANY, ddi_root_node(), - DDI_PROP_DONTPASS, "acpi-root-tab", NULL); + DDI_PROP_DONTPASS, "acpi-root-tab", 0); - if ((Address == NULL) && ACPI_FAILURE(AcpiFindRootPointer(&Address))) - Address = NULL; + if ((Address == 0) && ACPI_FAILURE(AcpiFindRootPointer(&Address))) + Address = 0; return (Address); } -- cgit v1.2.3 From 9c80534542e4b5924bcdb8adee652d01656e4889 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 14:48:52 +0200 Subject: 10768 kgssapi: NULL pointer errors Reviewed by: Andy Stormont Approved by: Dan McDonald --- usr/src/uts/common/gssapi/gssd_clnt_stubs.c | 24 ++++++++++++------------ usr/src/uts/common/gssapi/include/mechglueP.h | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/usr/src/uts/common/gssapi/gssd_clnt_stubs.c b/usr/src/uts/common/gssapi/gssd_clnt_stubs.c index c934752798..3793e47b0d 100644 --- a/usr/src/uts/common/gssapi/gssd_clnt_stubs.c +++ b/usr/src/uts/common/gssapi/gssd_clnt_stubs.c @@ -108,7 +108,7 @@ kgss_acquire_cred_wrapped(minor_status, { CLIENT *clnt; - OM_uint32 minor_status_temp; + OM_uint32 minor_status_temp; gss_buffer_desc external_name; gss_OID name_type; enum clnt_stat client_stat; @@ -200,7 +200,7 @@ kgss_acquire_cred_wrapped(minor_status, if (minor_status != NULL) *minor_status = DEFAULT_MINOR_STAT; if (output_cred_handle != NULL) - *output_cred_handle = NULL; + *output_cred_handle = 0; if (actual_mechs != NULL) *actual_mechs = NULL; if (time_rec != NULL) @@ -325,7 +325,7 @@ kgss_add_cred_wrapped(minor_status, { CLIENT *clnt; - OM_uint32 minor_status_temp; + OM_uint32 minor_status_temp; gss_buffer_desc external_name; gss_OID name_type; int i; @@ -555,7 +555,7 @@ kgss_release_cred_wrapped(minor_status, if (minor_status != NULL) *minor_status = DEFAULT_MINOR_STAT; if (cred_handle != NULL) - *cred_handle = NULL; + *cred_handle = 0; killgssd_handle(clnt); GSSLOG0(1, "kgss_release_cred: RPC call times out\n"); @@ -565,7 +565,7 @@ kgss_release_cred_wrapped(minor_status, /* if the release succeeded, null out the cred_handle */ if (res.status == GSS_S_COMPLETE && cred_handle != NULL) - *cred_handle = NULL; + *cred_handle = 0; /* copy the rpc results into the return arguments */ @@ -626,7 +626,7 @@ kgss_init_sec_context_wrapped( { CLIENT *clnt; - OM_uint32 minor_status_temp; + OM_uint32 minor_status_temp; gss_buffer_desc external_name; gss_OID name_type; @@ -1297,7 +1297,7 @@ kgss_delete_sec_context_wrapped(void *private, if (minor_status != NULL) *minor_status = DEFAULT_MINOR_STAT; if (context_handle != NULL) - *context_handle = NULL; + *context_handle = 0; if (output_token != NULL) output_token->length = 0; @@ -1312,7 +1312,7 @@ kgss_delete_sec_context_wrapped(void *private, *minor_status = res.minor_status; if (res.context_handle.GSS_CTX_ID_T_len == 0) - *context_handle = NULL; + *context_handle = 0; else *context_handle = *((gssd_ctx_id_t *)res.context_handle.GSS_CTX_ID_T_val); @@ -1421,7 +1421,7 @@ kgss_export_sec_context_wrapped(minor_status, if (minor_status != NULL) *minor_status = DEFAULT_MINOR_STAT; if (context_handle != NULL) - *context_handle = NULL; + *context_handle = 0; if (output_token != NULL) output_token->length = 0; killgssd_handle(clnt); @@ -1436,7 +1436,7 @@ kgss_export_sec_context_wrapped(minor_status, *minor_status = res.minor_status; if (res.context_handle.GSS_CTX_ID_T_len == 0) - *context_handle = NULL; + *context_handle = 0; else *context_handle = *((gssd_ctx_id_t *)res.context_handle.GSS_CTX_ID_T_val); @@ -1515,7 +1515,7 @@ kgss_import_sec_context(minor_status, OM_uint32 * minor_status; const gss_buffer_t interprocess_token; -gss_ctx_id_t context_handle; +gss_ctx_id_t context_handle; { OM_uint32 status; @@ -2187,7 +2187,7 @@ kgss_inquire_cred_wrapped(minor_status, { CLIENT *clnt; - OM_uint32 minor_status_temp; + OM_uint32 minor_status_temp; gss_buffer_desc external_name; gss_OID_desc name_type; int i; diff --git a/usr/src/uts/common/gssapi/include/mechglueP.h b/usr/src/uts/common/gssapi/include/mechglueP.h index f79b660c85..8a3e5f6125 100644 --- a/usr/src/uts/common/gssapi/include/mechglueP.h +++ b/usr/src/uts/common/gssapi/include/mechglueP.h @@ -46,7 +46,7 @@ #ifdef _KERNEL #include -#endif +#endif #ifndef g_OID_copy /* SUNW15resync */ #define g_OID_copy(o1, o2) \ @@ -154,9 +154,9 @@ typedef OM_uint32 (*gss_acquire_cred_with_password_sfct)( * * This contants all of the functions defined in gssapi.h except for * gss_release_buffer() and gss_release_oid_set(), which I am - * assuming, for now, to be equal across mechanisms. + * assuming, for now, to be equal across mechanisms. */ - + typedef struct gss_config { #if 0 /* Solaris Kerberos */ OM_uint32 priority; @@ -495,7 +495,7 @@ typedef struct gss_config { } *gss_mechanism; - + #ifndef _KERNEL /* This structure MUST NOT be used by any code outside libgss */ typedef struct gss_config_ext { @@ -536,7 +536,7 @@ gss_mechanism_ext __gss_get_mechanism_ext(const gss_OID); char *__gss_get_kmodName(const gss_OID); char *__gss_get_modOptions(const gss_OID); OM_uint32 __gss_import_internal_name(OM_uint32 *, const gss_OID, - gss_union_name_t, gss_name_t *); + gss_union_name_t, gss_name_t *); OM_uint32 __gss_export_internal_name(OM_uint32 *, const gss_OID, const gss_name_t, gss_buffer_t); OM_uint32 __gss_display_internal_name(OM_uint32 *, const gss_OID, @@ -721,7 +721,7 @@ struct kgss_ctx { (((ctx) == GSS_C_NO_CONTEXT) ? (gssd_ctx_id_t)(uintptr_t)(ctx) : \ KCTX_TO_GSSD_CTX(ctx)) #define KGSS_CTX_TO_GSSD_CTXV(ctx) \ - (((ctx) == GSS_C_NO_CONTEXT) ? (NULL) : KCTX_TO_CTXV(ctx)) + (((ctx) == GSS_C_NO_CONTEXT) ? (0) : KCTX_TO_CTXV(ctx)) #ifdef _KERNEL #define KCTX_TO_I_CTX(ctx) (KCTX_TO_KGSS_CTX(ctx)->gssd_i_ctx) -- cgit v1.2.3 From 28ec64d9ac03d17ce922c30274d804b981cda66e Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 14:51:02 +0200 Subject: 10769 ksocket: NULL pointer errors Reviewed by: Sebastian Wiedenroth Reviewed by: Patrick Mooney Approved by: Dan McDonald --- usr/src/uts/common/io/ksocket/ksocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/src/uts/common/io/ksocket/ksocket.c b/usr/src/uts/common/io/ksocket/ksocket.c index 17ac19b612..a3cd9dfbb1 100644 --- a/usr/src/uts/common/io/ksocket/ksocket.c +++ b/usr/src/uts/common/io/ksocket/ksocket.c @@ -841,7 +841,7 @@ ksocket_spoll(ksocket_t ks, int timo, short events, short *revents, if (pdp->pd_php != NULL) { pollhead_delete(pdp->pd_php, pdp); pdp->pd_php = NULL; - pdp->pd_fd = NULL; + pdp->pd_fd = 0; } /* -- cgit v1.2.3 From 03b18ed2fedba1f49023f25d34cbb6e4d0d8f435 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 15:13:45 +0200 Subject: 10771 ibmf: NULL pointer errors Reviewed by: Andy Stormont Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/common/io/ib/mgt/ibmf/ibmf_saa_utils.c | 8 +++----- usr/src/uts/common/io/ib/mgt/ibmf/ibmf_wqe.c | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/usr/src/uts/common/io/ib/mgt/ibmf/ibmf_saa_utils.c b/usr/src/uts/common/io/ib/mgt/ibmf/ibmf_saa_utils.c index 4c76719724..034ce8a881 100644 --- a/usr/src/uts/common/io/ib/mgt/ibmf/ibmf_saa_utils.c +++ b/usr/src/uts/common/io/ib/mgt/ibmf/ibmf_saa_utils.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -485,7 +483,7 @@ static void ibmf_saa_multipath_record_parse_buffer(uchar_t *buffer, uint16_t num_gids; sa_multipath_record_t *multipath_record = - (sa_multipath_record_t *)record; + (sa_multipath_record_t *)record; ibmf_utils_unpack_data("l2c2s14c", buffer, IBMF_SAA_MULTIPATH_RECORD_SIZE, multipath_record, @@ -871,7 +869,7 @@ static void ibmf_saa_multipath_record_to_buf(void *record, uchar_t *buffer) char gid_str[20]; uint16_t num_gids; sa_multipath_record_t *multipath_record = - (sa_multipath_record_t *)record; + (sa_multipath_record_t *)record; num_gids = multipath_record->SGIDCount + multipath_record->DGIDCount; @@ -974,7 +972,7 @@ ibmf_saa_utils_pack_payload(uchar_t *structs_payload, size_t if (structs_payload_length == 0) { - *buf_payload_lengthp = NULL; + *buf_payload_lengthp = 0; *buf_payloadp = NULL; return (IBMF_SUCCESS); diff --git a/usr/src/uts/common/io/ib/mgt/ibmf/ibmf_wqe.c b/usr/src/uts/common/io/ib/mgt/ibmf/ibmf_wqe.c index 9d0ec7b387..67a3092f24 100644 --- a/usr/src/uts/common/io/ib/mgt/ibmf/ibmf_wqe.c +++ b/usr/src/uts/common/io/ib/mgt/ibmf/ibmf_wqe.c @@ -87,7 +87,7 @@ ibmf_send_wqe_cache_constructor(void *buf, void *cdrarg, int kmflags) send_wqe->send_sg_mem = (ib_vaddr_t)(uintptr_t)vmem_alloc(cip->ci_wqe_ib_vmem, IBMF_MEM_PER_WQE, kmflags == KM_SLEEP ? VM_SLEEP : VM_NOSLEEP); - if (send_wqe->send_sg_mem == NULL) { + if (send_wqe->send_sg_mem == 0) { IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1, ibmf_send_wqe_cache_constructor_err, IBMF_TNF_ERROR, "", "ibmf_send_wqe_cache_constructor(): %s\n", tnf_string, msg, @@ -193,13 +193,13 @@ ibmf_recv_wqe_cache_constructor(void *buf, void *cdrarg, int kmflags) "ibmf_recv_wqe_cache_constructor() enter, buf = %p, cdarg = %p\n", tnf_opaque, buf, buf, tnf_opaque, cdrarg, cdrarg); - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*recv_wqe)) + _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*recv_wqe)) /* initialize recv WQE context */ recv_wqe->recv_sg_mem = (ib_vaddr_t)(uintptr_t)vmem_alloc(cip->ci_wqe_ib_vmem, IBMF_MEM_PER_WQE, kmflags == KM_SLEEP ? VM_SLEEP : VM_NOSLEEP); - if (recv_wqe->recv_sg_mem == NULL) { + if (recv_wqe->recv_sg_mem == 0) { IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1, ibmf_recv_wqe_cache_constructor_err, IBMF_TNF_ERROR, "", "ibmf_recv_wqe_cache_constructor(): %s\n", tnf_string, msg, @@ -277,7 +277,7 @@ ibmf_recv_wqe_cache_destructor(void *buf, void *cdrarg) "ibmf_recv_wqe_cache_destructor() enter, buf = %p, cdarg = %p\n", tnf_opaque, buf, buf, tnf_opaque, cdrarg, cdrarg); - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*recv_wqe)) + _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*recv_wqe)) /* Free the vmem allocated for the WQE */ vmem_free(cip->ci_wqe_ib_vmem, @@ -306,13 +306,13 @@ ibmf_altqp_send_wqe_cache_constructor(void *buf, void *cdrarg, int kmflags) "ibmf_altqp_send_wqe_cache_constructor() enter, buf = %p, " "cdarg = %p\n", tnf_opaque, buf, buf, tnf_opaque, cdrarg, cdrarg); - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*send_wqe)) + _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*send_wqe)) /* initialize send WQE context */ send_wqe->send_sg_mem = (ib_vaddr_t)(uintptr_t)vmem_alloc( qp_ctx->isq_wqe_ib_vmem, IBMF_MEM_PER_WQE, kmflags == KM_SLEEP ? VM_SLEEP : VM_NOSLEEP); - if (send_wqe->send_sg_mem == NULL) { + if (send_wqe->send_sg_mem == 0) { IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1, ibmf_altqp_send_wqe_cache_constructor_err, IBMF_TNF_ERROR, "", "ibmf_altqp_send_wqe_cache_constructor(): %s\n", @@ -390,7 +390,7 @@ ibmf_altqp_send_wqe_cache_destructor(void *buf, void *cdrarg) "ibmf_altqp_send_wqe_cache_destructor() enter, buf = %p, " "cdarg = %p\n", tnf_opaque, buf, buf, tnf_opaque, cdrarg, cdrarg); - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*send_wqe)) + _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*send_wqe)) /* Free the vmem allocated for the WQE */ vmem_free(qp_ctx->isq_wqe_ib_vmem, @@ -419,13 +419,13 @@ ibmf_altqp_recv_wqe_cache_constructor(void *buf, void *cdrarg, int kmflags) "ibmf_altqp_recv_wqe_cache_constructor() enter, buf = %p, " "cdarg = %p\n", tnf_opaque, buf, buf, tnf_opaque, cdrarg, cdrarg); - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*recv_wqe)) + _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*recv_wqe)) /* initialize recv WQE context */ recv_wqe->recv_sg_mem = (ib_vaddr_t)(uintptr_t)vmem_alloc( qp_ctx->isq_wqe_ib_vmem, IBMF_MEM_PER_WQE, kmflags == KM_SLEEP ? VM_SLEEP : VM_NOSLEEP); - if (recv_wqe->recv_sg_mem == NULL) { + if (recv_wqe->recv_sg_mem == 0) { IBMF_TRACE_1(IBMF_TNF_NODEBUG, DPRINT_L1, ibmf_altqp_recv_wqe_cache_constructor_err, IBMF_TNF_ERROR, "", "ibmf_altqp_recv_wqe_cache_constructor(): %s\n", @@ -502,7 +502,7 @@ ibmf_altqp_recv_wqe_cache_destructor(void *buf, void *cdrarg) "ibmf_altqp_recv_wqe_cache_destructor() enter, buf = %p, " "cdarg = %p\n", tnf_opaque, buf, buf, tnf_opaque, cdrarg, cdrarg); - _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*recv_wqe)) + _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*recv_wqe)) /* Free the vmem allocated for the WQE */ vmem_free(qp_ctx->isq_wqe_ib_vmem, -- cgit v1.2.3 From 0f677ac901babf1fada10fcc386de1c3d4d4ecad Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 15:28:24 +0200 Subject: 10772 kcf: NULL pointer errors Reviewed by: Andy Stormont Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/common/crypto/api/kcf_dual.c | 4 +- usr/src/uts/common/crypto/core/kcf_cryptoadm.c | 71 ++++++++++++++------------ 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/usr/src/uts/common/crypto/api/kcf_dual.c b/usr/src/uts/common/crypto/api/kcf_dual.c index 7d6f726e72..5fd2c989c4 100644 --- a/usr/src/uts/common/crypto/api/kcf_dual.c +++ b/usr/src/uts/common/crypto/api/kcf_dual.c @@ -261,7 +261,7 @@ retry: * mac_ctx_tmpl, once it picks a MAC provider. */ KCF_WRAP_MAC_OPS_PARAMS(&(next_req->kr_params), - KCF_OP_ATOMIC, NULL, mac_mech, mac_key, + KCF_OP_ATOMIC, 0, mac_mech, mac_key, (crypto_data_t *)ct, mac, mac_tmpl); } @@ -1213,7 +1213,7 @@ retry: } KCF_WRAP_DECRYPT_OPS_PARAMS( &(next_req->kr_params), KCF_OP_ATOMIC, - NULL, decr_mech, decr_key, + 0, decr_mech, decr_key, (crypto_data_t *)ct, pt, spi_decr_tmpl); } diff --git a/usr/src/uts/common/crypto/core/kcf_cryptoadm.c b/usr/src/uts/common/crypto/core/kcf_cryptoadm.c index 54e7c533ad..19fc558088 100644 --- a/usr/src/uts/common/crypto/core/kcf_cryptoadm.c +++ b/usr/src/uts/common/crypto/core/kcf_cryptoadm.c @@ -86,7 +86,7 @@ count_mechanisms(crypto_mech_name_t mechs[]) * of kernel software providers. * Called from kcf module _init(). */ -void + void kcf_soft_config_init(void) { typedef struct { @@ -133,51 +133,53 @@ kcf_soft_config_init(void) * cryptosvc runs), add to kcf_init_mech_tabs() in kcf_mech_tabs.c. */ static crypto_mech_name_t des_mechs[] = { - "CKM_DES_CBC", "CKM_DES_ECB", "CKM_DES3_CBC", "CKM_DES3_ECB", ""}; + "CKM_DES_CBC", "CKM_DES_ECB", "CKM_DES3_CBC", "CKM_DES3_ECB", + ""}; static crypto_mech_name_t aes_mechs[] = { - "CKM_AES_ECB", "CKM_AES_CBC", "CKM_AES_CTR", "CKM_AES_CCM", - "CKM_AES_GCM", "CKM_AES_GMAC", "CKM_AES_CMAC", ""}; + "CKM_AES_ECB", "CKM_AES_CBC", "CKM_AES_CTR", "CKM_AES_CCM", + "CKM_AES_GCM", "CKM_AES_GMAC", "CKM_AES_CMAC", ""}; static crypto_mech_name_t arcfour_mechs[] = { - "CKM_RC4", ""}; + "CKM_RC4", ""}; static crypto_mech_name_t blowfish_mechs[] = { - "CKM_BLOWFISH_ECB", "CKM_BLOWFISH_CBC", ""}; + "CKM_BLOWFISH_ECB", "CKM_BLOWFISH_CBC", ""}; static crypto_mech_name_t ecc_mechs[] = { - "CKM_EC_KEY_PAIR_GEN", "CKM_ECDH1_DERIVE", "CKM_ECDSA", - "CKM_ECDSA_SHA1", ""}; + "CKM_EC_KEY_PAIR_GEN", "CKM_ECDH1_DERIVE", "CKM_ECDSA", + "CKM_ECDSA_SHA1", ""}; static crypto_mech_name_t sha1_mechs[] = { - "CKM_SHA_1", "CKM_SHA_1_HMAC_GENERAL", "CKM_SHA_1_HMAC", ""}; + "CKM_SHA_1", "CKM_SHA_1_HMAC_GENERAL", "CKM_SHA_1_HMAC", ""}; static crypto_mech_name_t sha2_mechs[] = { - "CKM_SHA256", "CKM_SHA256_HMAC", "CKM_SHA256_HMAC_GENERAL", - "CKM_SHA384", "CKM_SHA384_HMAC", "CKM_SHA384_HMAC_GENERAL", - "CKM_SHA512", "CKM_SHA512_HMAC", "CKM_SHA512_HMAC_GENERAL", ""}; + "CKM_SHA256", "CKM_SHA256_HMAC", "CKM_SHA256_HMAC_GENERAL", + "CKM_SHA384", "CKM_SHA384_HMAC", "CKM_SHA384_HMAC_GENERAL", + "CKM_SHA512", "CKM_SHA512_HMAC", "CKM_SHA512_HMAC_GENERAL", ""}; static crypto_mech_name_t md4_mechs[] = { - "CKM_MD4", ""}; + "CKM_MD4", ""}; static crypto_mech_name_t md5_mechs[] = { - "CKM_MD5", "CKM_MD5_HMAC_GENERAL", "CKM_MD5_HMAC", ""}; + "CKM_MD5", "CKM_MD5_HMAC_GENERAL", "CKM_MD5_HMAC", ""}; static crypto_mech_name_t rsa_mechs[] = { - "CKM_RSA_PKCS", "CKM_RSA_X_509", "CKM_MD5_RSA_PKCS", - "CKM_SHA1_RSA_PKCS", "CKM_SHA256_RSA_PKCS", "CKM_SHA384_RSA_PKCS", - "CKM_SHA512_RSA_PKCS", ""}; + "CKM_RSA_PKCS", "CKM_RSA_X_509", "CKM_MD5_RSA_PKCS", + "CKM_SHA1_RSA_PKCS", "CKM_SHA256_RSA_PKCS", + "CKM_SHA384_RSA_PKCS", + "CKM_SHA512_RSA_PKCS", ""}; static crypto_mech_name_t swrand_mechs[] = { - "random", NULL}; + "random", ""}; static initial_soft_config_entry_t - initial_soft_config_entry[] = { - "des", des_mechs, - "aes", aes_mechs, - "arcfour", arcfour_mechs, - "blowfish", blowfish_mechs, - "ecc", ecc_mechs, - "sha1", sha1_mechs, - "sha2", sha2_mechs, - "md4", md4_mechs, - "md5", md5_mechs, - "rsa", rsa_mechs, - "swrand", swrand_mechs - }; - const int initial_soft_config_entries = + initial_soft_config_entry[] = { + "des", des_mechs, + "aes", aes_mechs, + "arcfour", arcfour_mechs, + "blowfish", blowfish_mechs, + "ecc", ecc_mechs, + "sha1", sha1_mechs, + "sha2", sha2_mechs, + "md4", md4_mechs, + "md5", md5_mechs, + "rsa", rsa_mechs, + "swrand", swrand_mechs + }; + const int initial_soft_config_entries = sizeof (initial_soft_config_entry) / sizeof (initial_soft_config_entry_t); - int i; + int i; mutex_init(&soft_config_mutex, NULL, MUTEX_DRIVER, NULL); @@ -198,10 +200,11 @@ kcf_soft_config_init(void) bcopy(p->mechs, mechsp, alloc_size); r = add_soft_config(p->name, mech_count, mechsp); - if (r != 0) + if (r != 0) { cmn_err(CE_WARN, "add_soft_config(%s) failed; returned %d\n", p->name, r); + } } #if DEBUG if (kcf_frmwrk_debug >= 1) -- cgit v1.2.3 From e9f74ea56f674c729c7fa4812e7fc668a9c24070 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 09:23:49 +0200 Subject: 10738 sockfs: NULL pointer errors Reviewed by: Robert Mustacchi Reviewed by: Andy Fiddaman Approved by: Dan McDonald --- usr/src/uts/common/fs/sockfs/nl7c.c | 51 +++++++++++++-------------------- usr/src/uts/common/fs/sockfs/nl7ctokgen | 5 +--- usr/src/uts/common/fs/sockfs/nl7curi.c | 17 ++++------- usr/src/uts/common/fs/sockfs/socktpi.c | 28 +++++++++--------- 4 files changed, 40 insertions(+), 61 deletions(-) diff --git a/usr/src/uts/common/fs/sockfs/nl7c.c b/usr/src/uts/common/fs/sockfs/nl7c.c index 88584eda68..c76dada8d7 100644 --- a/usr/src/uts/common/fs/sockfs/nl7c.c +++ b/usr/src/uts/common/fs/sockfs/nl7c.c @@ -51,6 +51,8 @@ #include #include #include +#include +#include #include #include #include @@ -266,26 +268,6 @@ nl7c_mi_report_addr(mblk_t *mp) } } -/* - * ASCII to unsigned. - * - * Note, it's assumed that *p is a valid zero byte terminated string. - */ - -static unsigned -atou(const char *p) -{ - int c; - int v = 0; - - /* Shift and add digit by digit */ - while ((c = *p++) != NULL && isdigit(c)) { - v *= 10; - v += c - '0'; - } - return (v); -} - /* * Inet ASCII to binary. * @@ -417,7 +399,7 @@ ncaportconf_read(void) parse = EOL; } } else if (c == '=') { - if (*tok != NULL) { + if (*tok != '\0') { /* Only know one token, skip */ parse = EOL; break; @@ -435,7 +417,7 @@ ncaportconf_read(void) case ADDR: if (c == '/') { /* addr/port separator, end of addr */ - *stringp = NULL; + *stringp = 0; if (inet_atob(string, addrp)) { /* Bad addr, skip */ parse = EOL; @@ -469,9 +451,16 @@ ncaportconf_read(void) } break; } else if (c == '#' || isspace(c)) { + unsigned long result = 0; + /* End of port number, convert */ - *stringp = NULL; - addrp->port = ntohs(atou(string)); + *stringp = '\0'; + if (ddi_strtoul(string, NULL, 10, &result) + != 0) { + parse = EOL; + break; + } + addrp->port = ntohs(result); /* End of parse, add entry */ nl7c_addr_add(addrp); @@ -582,7 +571,7 @@ ncakmodconf_read(void) * Found EOL, if tok found done, * else start on next-line. */ - if (*tok == NULL) { + if (*tok == '\0') { nl7c_enabled = B_TRUE; goto done; } @@ -721,11 +710,11 @@ ncalogdconf_read(void) * Found tok separator, if tok found get * tok text, else skip rest of line. */ - if (tokstatusp != NULL && *tokstatusp == NULL) + if (tokstatusp != NULL && *tokstatusp == '\0') tok = tokstatus; - else if (toksizep != NULL && *toksizep == NULL) + else if (toksizep != NULL && *toksizep == '\0') tok = toksize; - else if (tokfilep != NULL && *tokfilep == NULL) + else if (tokfilep != NULL && *tokfilep == '\0') tok = tokfile; if (tok != NULL) parse = TEXT; @@ -746,7 +735,7 @@ ncalogdconf_read(void) * (if any) and start on next line. */ if (tok == tokstatus) { - if (*++tokstatusp == NULL) + if (*++tokstatusp == '\0') nl7c_logd_enabled = B_TRUE; } else if (tok == toksize) { file_size = sz; @@ -761,7 +750,7 @@ ncalogdconf_read(void) } parse = START; } else if (tok == tokstatus) { - if (! isalpha(c) || *++tokstatusp == NULL || + if (! isalpha(c) || *++tokstatusp == '\0' || c != *tokstatusp) { /* Not enabled, skip line */ parse = EOL; @@ -921,7 +910,7 @@ nl7c_process(struct sonode *so, boolean_t nonblocking) clock_t timout; rval_t rval; uchar_t pri; - int pflag; + int pflag; int error; boolean_t more; boolean_t ret = B_FALSE; diff --git a/usr/src/uts/common/fs/sockfs/nl7ctokgen b/usr/src/uts/common/fs/sockfs/nl7ctokgen index d3dfe2ed20..1cdf1d2d1f 100755 --- a/usr/src/uts/common/fs/sockfs/nl7ctokgen +++ b/usr/src/uts/common/fs/sockfs/nl7ctokgen @@ -20,9 +20,6 @@ # # CDDL HEADER END # -# -#ident "%Z%%M% %I% %E% SMI" -# # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -60,7 +57,7 @@ NAME=${NAME%.txt} TOKEN="$TOKEN token_t $NAME[] = { $ELE - {NULL} + {0} }; #define ${NAME}_cnt (sizeof ($NAME) / sizeof (*$NAME)) diff --git a/usr/src/uts/common/fs/sockfs/nl7curi.c b/usr/src/uts/common/fs/sockfs/nl7curi.c index c6818babe7..a8d46d0fe0 100644 --- a/usr/src/uts/common/fs/sockfs/nl7curi.c +++ b/usr/src/uts/common/fs/sockfs/nl7curi.c @@ -926,7 +926,7 @@ add: ruri->hit = 0; ruri->expire = -1; ruri->response.sz = 0; - ruri->proc = (struct sonode *)~NULL; + ruri->proc = (struct sonode *)~0; cv_init(&ruri->waiting, NULL, CV_DEFAULT, NULL); mutex_init(&ruri->proclock, NULL, MUTEX_DEFAULT, NULL); uri_add(ruri, RW_READER, nonblocking); @@ -1276,7 +1276,7 @@ nl7c_readfile(file_t *fp, u_offset_t *off, int *len, int max, int *ret) int nl7c_sendfilev(struct sonode *so, u_offset_t *fileoff, sendfilevec_t *sfvp, - int sfvc, ssize_t *xfer) + int sfvc, ssize_t *xfer) { sotpi_info_t *sti = SOTOTPI(so); uri_desc_t *uri = (uri_desc_t *)sti->sti_nl7c_uri; @@ -1480,7 +1480,7 @@ void nl7c_close(struct sonode *so) { sotpi_info_t *sti = SOTOTPI(so); - uri_desc_t *uri = (uri_desc_t *)sti->sti_nl7c_uri; + uri_desc_t *uri = (uri_desc_t *)sti->sti_nl7c_uri; if (uri == NULL) { /* @@ -1585,15 +1585,8 @@ uri_segmap_map(uri_rd_t *rdp, int bytes) */ static mblk_t * -uri_desb_chop( - char **data, - size_t *sz, - int *bytes, - uri_desb_t *temp, - int max_mblk, - char *eoh, - mblk_t *persist -) +uri_desb_chop(char **data, size_t *sz, int *bytes, uri_desb_t *temp, + int max_mblk, char *eoh, mblk_t *persist) { char *ldata = *data; size_t lsz = *sz; diff --git a/usr/src/uts/common/fs/sockfs/socktpi.c b/usr/src/uts/common/fs/sockfs/socktpi.c index bbeee8ce4b..cbb8eccd23 100644 --- a/usr/src/uts/common/fs/sockfs/socktpi.c +++ b/usr/src/uts/common/fs/sockfs/socktpi.c @@ -88,12 +88,12 @@ /* * Possible failures when memory can't be allocated. The documented behavior: * - * 5.5: 4.X: XNET: + * 5.5: 4.X: XNET: * accept: ENOMEM/ENOSR/EINTR - (EINTR) ENOMEM/ENOBUFS/ENOSR/ * EINTR * (4.X does not document EINTR but returns it) * bind: ENOSR - ENOBUFS/ENOSR - * connect: EINTR EINTR ENOBUFS/ENOSR/EINTR + * connect: EINTR EINTR ENOBUFS/ENOSR/EINTR * getpeername: ENOMEM/ENOSR ENOBUFS (-) ENOBUFS/ENOSR * getsockname: ENOMEM/ENOSR ENOBUFS (-) ENOBUFS/ENOSR * (4.X getpeername and getsockname do not fail in practice) @@ -182,8 +182,8 @@ static struct sonode *sotpi_create(struct sockparams *, int, int, int, int, static boolean_t sotpi_info_create(struct sonode *, int); static void sotpi_info_init(struct sonode *); -static void sotpi_info_fini(struct sonode *); -static void sotpi_info_destroy(struct sonode *); +static void sotpi_info_fini(struct sonode *); +static void sotpi_info_destroy(struct sonode *); /* * Do direct function call to the transport layer below; this would @@ -202,7 +202,7 @@ extern void sigunintr(k_sigset_t *); static int sotpi_unbind(struct sonode *, int); /* TPI sockfs sonode operations */ -int sotpi_init(struct sonode *, struct sonode *, struct cred *, +int sotpi_init(struct sonode *, struct sonode *, struct cred *, int); static int sotpi_accept(struct sonode *, int, struct cred *, struct sonode **); @@ -230,16 +230,16 @@ extern int sotpi_getsockopt(struct sonode *, int, int, void *, socklen_t *, int, struct cred *); extern int sotpi_setsockopt(struct sonode *, int, int, const void *, socklen_t, struct cred *); -static int sotpi_ioctl(struct sonode *, int, intptr_t, int, struct cred *, +static int sotpi_ioctl(struct sonode *, int, intptr_t, int, struct cred *, int32_t *); -static int socktpi_plumbioctl(struct vnode *, int, intptr_t, int, +static int socktpi_plumbioctl(struct vnode *, int, intptr_t, int, struct cred *, int32_t *); -static int sotpi_poll(struct sonode *, short, int, short *, +static int sotpi_poll(struct sonode *, short, int, short *, struct pollhead **); -static int sotpi_close(struct sonode *, int, struct cred *); +static int sotpi_close(struct sonode *, int, struct cred *); static int i_sotpi_info_constructor(sotpi_info_t *); -static void i_sotpi_info_destructor(sotpi_info_t *); +static void i_sotpi_info_destructor(sotpi_info_t *); sonodeops_t sotpi_sonodeops = { sotpi_init, /* sop_init */ @@ -279,7 +279,7 @@ sotpi_create(struct sockparams *sp, int family, int type, int protocol, int version, int sflags, int *errorp, cred_t *cr) { struct sonode *so; - kmem_cache_t *cp; + kmem_cache_t *cp; int sfamily = family; ASSERT(sp->sp_sdev_info.sd_vnode != NULL); @@ -6109,7 +6109,7 @@ sotpi_ioctl(struct sonode *so, int cmd, intptr_t arg, int mode, #ifdef DEBUG zcmn_err(getzoneid(), CE_WARN, "Unsupported STREAMS ioctl 0x%x on socket. " - "Pid = %d\n", cmd, curproc->p_pid); + "Pid = %d\n", cmd, curproc->p_pid); #endif /* DEBUG */ return (EOPNOTSUPP); } @@ -6201,7 +6201,7 @@ socktpi_plumbioctl(struct vnode *vp, int cmd, intptr_t arg, int mode, STRUCT_DECL(str_list, ustrlist); STRUCT_INIT(ustrlist, mode); - if (arg == NULL) { + if (arg == 0) { error = strioctl(vp, cmd, arg, mode, U_TO_K, cr, rvalp); if (error == 0) (*rvalp)++; /* Add one for sockmod */ @@ -6799,7 +6799,7 @@ sotpi_info_init(struct sonode *so) sotpi_info_t *sti = SOTOTPI(so); time_t now; - sti->sti_dev = so->so_sockparams->sp_sdev_info.sd_vnode->v_rdev; + sti->sti_dev = so->so_sockparams->sp_sdev_info.sd_vnode->v_rdev; vp->v_rdev = sti->sti_dev; sti->sti_orig_sp = NULL; -- cgit v1.2.3 From b38836b5d7f7e27aad97495457921171be74e408 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 16:48:22 +0200 Subject: 10773 sata: NULL pointer errors Reviewed by: Andy Stormont Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/common/io/sata/impl/sata.c | 112 +++++++++++++-------------- usr/src/uts/common/sys/sata/sata_blacklist.h | 2 +- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/usr/src/uts/common/io/sata/impl/sata.c b/usr/src/uts/common/io/sata/impl/sata.c index 55da099035..617aa8ea5a 100644 --- a/usr/src/uts/common/io/sata/impl/sata.c +++ b/usr/src/uts/common/io/sata/impl/sata.c @@ -151,9 +151,9 @@ static char sata_rev_tag[] = {"1.46"}; /* * SATA cb_ops functions */ -static int sata_hba_open(dev_t *, int, int, cred_t *); -static int sata_hba_close(dev_t, int, int, cred_t *); -static int sata_hba_ioctl(dev_t, int, intptr_t, int, cred_t *, int *); +static int sata_hba_open(dev_t *, int, int, cred_t *); +static int sata_hba_close(dev_t, int, int, cred_t *); +static int sata_hba_ioctl(dev_t, int, intptr_t, int, cred_t *, int *); /* * SCSA required entry points @@ -164,17 +164,17 @@ static int sata_scsi_tgt_probe(struct scsi_device *, int (*callback)(void)); static void sata_scsi_tgt_free(dev_info_t *, dev_info_t *, scsi_hba_tran_t *, struct scsi_device *); -static int sata_scsi_start(struct scsi_address *, struct scsi_pkt *); -static int sata_scsi_abort(struct scsi_address *, struct scsi_pkt *); -static int sata_scsi_reset(struct scsi_address *, int); -static int sata_scsi_getcap(struct scsi_address *, char *, int); -static int sata_scsi_setcap(struct scsi_address *, char *, int, int); -static struct scsi_pkt *sata_scsi_init_pkt(struct scsi_address *, +static int sata_scsi_start(struct scsi_address *, struct scsi_pkt *); +static int sata_scsi_abort(struct scsi_address *, struct scsi_pkt *); +static int sata_scsi_reset(struct scsi_address *, int); +static int sata_scsi_getcap(struct scsi_address *, char *, int); +static int sata_scsi_setcap(struct scsi_address *, char *, int, int); +static struct scsi_pkt *sata_scsi_init_pkt(struct scsi_address *, struct scsi_pkt *, struct buf *, int, int, int, int, int (*)(caddr_t), caddr_t); -static void sata_scsi_destroy_pkt(struct scsi_address *, struct scsi_pkt *); -static void sata_scsi_dmafree(struct scsi_address *, struct scsi_pkt *); -static void sata_scsi_sync_pkt(struct scsi_address *, struct scsi_pkt *); +static void sata_scsi_destroy_pkt(struct scsi_address *, struct scsi_pkt *); +static void sata_scsi_dmafree(struct scsi_address *, struct scsi_pkt *); +static void sata_scsi_sync_pkt(struct scsi_address *, struct scsi_pkt *); /* * SATA HBA interface functions are defined in sata_hba.h header file @@ -281,25 +281,25 @@ static int sata_ioctl_get_serialnumber_info(sata_hba_inst_t *, /* * Local functions */ -static void sata_remove_hba_instance(dev_info_t *); -static int sata_validate_sata_hba_tran(dev_info_t *, sata_hba_tran_t *); -static void sata_probe_ports(sata_hba_inst_t *); +static void sata_remove_hba_instance(dev_info_t *); +static int sata_validate_sata_hba_tran(dev_info_t *, sata_hba_tran_t *); +static void sata_probe_ports(sata_hba_inst_t *); static void sata_probe_pmports(sata_hba_inst_t *, uint8_t); -static int sata_reprobe_port(sata_hba_inst_t *, sata_device_t *, int); -static int sata_reprobe_pmult(sata_hba_inst_t *, sata_device_t *, int); -static int sata_reprobe_pmport(sata_hba_inst_t *, sata_device_t *, int); +static int sata_reprobe_port(sata_hba_inst_t *, sata_device_t *, int); +static int sata_reprobe_pmult(sata_hba_inst_t *, sata_device_t *, int); +static int sata_reprobe_pmport(sata_hba_inst_t *, sata_device_t *, int); static int sata_alloc_pmult(sata_hba_inst_t *, sata_device_t *); static void sata_free_pmult(sata_hba_inst_t *, sata_device_t *); -static int sata_add_device(dev_info_t *, sata_hba_inst_t *, sata_device_t *); +static int sata_add_device(dev_info_t *, sata_hba_inst_t *, sata_device_t *); static int sata_offline_device(sata_hba_inst_t *, sata_device_t *, sata_drive_info_t *); -static dev_info_t *sata_create_target_node(dev_info_t *, sata_hba_inst_t *, +static dev_info_t *sata_create_target_node(dev_info_t *, sata_hba_inst_t *, sata_address_t *); -static void sata_remove_target_node(sata_hba_inst_t *, +static void sata_remove_target_node(sata_hba_inst_t *, sata_address_t *); -static int sata_validate_scsi_address(sata_hba_inst_t *, +static int sata_validate_scsi_address(sata_hba_inst_t *, struct scsi_address *, sata_device_t *); -static int sata_validate_sata_address(sata_hba_inst_t *, int, int, int); +static int sata_validate_sata_address(sata_hba_inst_t *, int, int, int); static sata_pkt_t *sata_pkt_alloc(sata_pkt_txlate_t *, int (*)(caddr_t)); static void sata_pkt_free(sata_pkt_txlate_t *); static int sata_dma_buf_setup(sata_pkt_txlate_t *, int, int (*)(caddr_t), @@ -308,14 +308,14 @@ static void sata_common_free_dma_rsrcs(sata_pkt_txlate_t *); static int sata_probe_device(sata_hba_inst_t *, sata_device_t *); static sata_drive_info_t *sata_get_device_info(sata_hba_inst_t *, sata_device_t *); -static int sata_identify_device(sata_hba_inst_t *, sata_drive_info_t *); +static int sata_identify_device(sata_hba_inst_t *, sata_drive_info_t *); static void sata_reidentify_device(sata_pkt_txlate_t *); static struct buf *sata_alloc_local_buffer(sata_pkt_txlate_t *, int); -static void sata_free_local_buffer(sata_pkt_txlate_t *); -static uint64_t sata_check_capacity(sata_drive_info_t *); -void sata_adjust_dma_attr(sata_drive_info_t *, ddi_dma_attr_t *, +static void sata_free_local_buffer(sata_pkt_txlate_t *); +static uint64_t sata_check_capacity(sata_drive_info_t *); +void sata_adjust_dma_attr(sata_drive_info_t *, ddi_dma_attr_t *, ddi_dma_attr_t *); -static int sata_fetch_device_identify_data(sata_hba_inst_t *, +static int sata_fetch_device_identify_data(sata_hba_inst_t *, sata_drive_info_t *); static void sata_update_port_info(sata_hba_inst_t *, sata_device_t *); static void sata_update_pmport_info(sata_hba_inst_t *, sata_device_t *); @@ -469,7 +469,7 @@ static ddi_device_acc_attr_t sata_acc_attr = { static kmutex_t sata_mutex; /* protects sata_hba_list */ static kmutex_t sata_log_mutex; /* protects log */ -static char sata_log_buf[256]; +static char sata_log_buf[256]; /* * sata trace debug @@ -497,8 +497,8 @@ int sata_atapidisk_write_cache = 1; /* enabled */ /* * Linked list of HBA instances */ -static sata_hba_inst_t *sata_hba_list = NULL; -static sata_hba_inst_t *sata_hba_list_tail = NULL; +static sata_hba_inst_t *sata_hba_list = NULL; +static sata_hba_inst_t *sata_hba_list_tail = NULL; /* * Pointer to per-instance SATA HBA soft structure is stored in sata_hba_tran * structure and in sata soft state. @@ -507,13 +507,13 @@ static sata_hba_inst_t *sata_hba_list_tail = NULL; /* * Event daemon related variables */ -static kmutex_t sata_event_mutex; -static kcondvar_t sata_event_cv; -static kthread_t *sata_event_thread = NULL; -static int sata_event_thread_terminate = 0; -static int sata_event_pending = 0; -static int sata_event_thread_active = 0; -extern pri_t minclsyspri; +static kmutex_t sata_event_mutex; +static kcondvar_t sata_event_cv; +static kthread_t *sata_event_thread = NULL; +static int sata_event_thread_terminate = 0; +static int sata_event_pending = 0; +static int sata_event_thread_active = 0; +extern pri_t minclsyspri; /* * NCQ error recovery command @@ -1499,7 +1499,7 @@ sata_hba_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp, rv = EFAULT; break; } - ioc.cmd = (uint_t)ioc32.cmd; + ioc.cmd = (uint_t)ioc32.cmd; ioc.port = (uint_t)ioc32.port; ioc.get_size = (uint_t)ioc32.get_size; ioc.buf = (caddr_t)(uintptr_t)ioc32.buf; @@ -2890,12 +2890,12 @@ static int sata_scsi_getcap(struct scsi_address *ap, char *cap, int whom) { - sata_hba_inst_t *sata_hba_inst = + sata_hba_inst_t *sata_hba_inst = (sata_hba_inst_t *)(ap->a_hba_tran->tran_hba_private); sata_device_t sata_device; sata_drive_info_t *sdinfo; ddi_dma_attr_t adj_dma_attr; - int rval; + int rval; SATADBG2(SATA_DBG_SCSI_IF, sata_hba_inst, "sata_scsi_getcap: target: 0x%x, cap: %s\n", @@ -4990,7 +4990,7 @@ sata_txlt_mode_sense(sata_pkt_txlate_t *spx) sata_drive_info_t *sdinfo; sata_id_t *sata_id; struct scsi_extended_sense *sense; - int len, bdlen, count, alc_len; + int len, bdlen, count, alc_len; int pc; /* Page Control code */ uint8_t *buf; /* mode sense buffer */ int rval, reason; @@ -5831,14 +5831,14 @@ sata_txlt_ata_pass_thru(sata_pkt_txlate_t *spx) /* * Translate command: Log Sense */ -static int +static int sata_txlt_log_sense(sata_pkt_txlate_t *spx) { struct scsi_pkt *scsipkt = spx->txlt_scsi_pkt; struct buf *bp = spx->txlt_sata_pkt->satapkt_cmd.satacmd_bp; sata_drive_info_t *sdinfo; struct scsi_extended_sense *sense; - int len, count, alc_len; + int len, count, alc_len; int pc; /* Page Control code */ int page_code; /* Page code */ uint8_t *buf; /* log sense buffer */ @@ -6901,7 +6901,7 @@ sata_reidentify_device(sata_pkt_txlate_t *spx) * Returns TRAN_ACCEPT or code returned by sata_hba_start() and * appropriate values in scsi_pkt fields. */ -static int +static int sata_txlt_synchronize_cache(sata_pkt_txlate_t *spx) { sata_cmd_t *scmd = &spx->txlt_sata_pkt->satapkt_cmd; @@ -10439,12 +10439,12 @@ sata_remove_hba_instance(dev_info_t *dip) * when there is no device attached. */ -static void +static void sata_probe_ports(sata_hba_inst_t *sata_hba_inst) { dev_info_t *dip = SATA_DIP(sata_hba_inst); int ncport; - sata_cport_info_t *cportinfo; + sata_cport_info_t *cportinfo; sata_drive_info_t *drive; sata_device_t sata_device; int rval; @@ -10579,7 +10579,7 @@ sata_probe_pmports(sata_hba_inst_t *sata_hba_inst, uint8_t ncport) { dev_info_t *dip = SATA_DIP(sata_hba_inst); sata_pmult_info_t *pmultinfo = NULL; - sata_pmport_info_t *pmportinfo = NULL; + sata_pmport_info_t *pmportinfo = NULL; sata_drive_info_t *drive = NULL; sata_device_t sata_device; @@ -10678,11 +10678,11 @@ reprobe_pmport: * device identification failed - adding a device could be retried. * */ -static int +static int sata_add_device(dev_info_t *pdip, sata_hba_inst_t *sata_hba_inst, sata_device_t *sata_device) { - sata_cport_info_t *cportinfo; + sata_cport_info_t *cportinfo; sata_pmult_info_t *pminfo; sata_pmport_info_t *pmportinfo; dev_info_t *cdip; /* child dip */ @@ -12434,7 +12434,7 @@ sata_devt_to_devinfo(dev_t dev) * Returns: * SATA_SUCCESS if device type was successfully probed and port-linked * drive info structure was updated; - * SATA_FAILURE if there is no device, or device was not probed + * SATA_FAILURE if there is no device, or device was not probed * successully; * SATA_RETRY if device probe can be retried later. * If a device cannot be identified, sata_device's dev_state and dev_type @@ -14348,7 +14348,7 @@ sata_get_target_dip(dev_info_t *dip, uint8_t cport, uint8_t pmport) { dev_info_t *cdip = NULL; int target, tgt; - int circ; + int circ; uint8_t qual; sata_hba_inst_t *sata_hba_inst; @@ -14413,7 +14413,7 @@ sata_get_scsi_target_dip(dev_info_t *dip, sata_address_t *saddr) { dev_info_t *cdip = NULL; int target, tgt; - int circ; + int circ; target = SATA_TO_SCSI_TARGET(saddr->cport, saddr->pmport, saddr->qual); @@ -17543,8 +17543,8 @@ sata_log(sata_hba_inst_t *sata_hba_inst, uint_t level, char *fmt, ...) static void sata_event_thread_control(int startstop) { - static int sata_event_thread_terminating = 0; - static int sata_event_thread_starting = 0; + static int sata_event_thread_terminating = 0; + static int sata_event_thread_starting = 0; int i; mutex_enter(&sata_event_mutex); @@ -18169,7 +18169,7 @@ sata_process_controller_events(sata_hba_inst_t *sata_hba_inst) mutex_enter(&sata_hba_inst->satahba_mutex); cportinfo = SATA_CPORT_INFO(sata_hba_inst, ncport); mutex_exit(&sata_hba_inst->satahba_mutex); - if (cportinfo == NULL || cportinfo->cport_state == NULL) + if (cportinfo == NULL || cportinfo->cport_state == 0) continue; /* We have initialized controller port info */ diff --git a/usr/src/uts/common/sys/sata/sata_blacklist.h b/usr/src/uts/common/sys/sata/sata_blacklist.h index 3428035615..f55259891b 100644 --- a/usr/src/uts/common/sys/sata/sata_blacklist.h +++ b/usr/src/uts/common/sys/sata/sata_blacklist.h @@ -54,7 +54,7 @@ sata_pmult_bl_t sata_pmult_blacklist[] = { {0x37261095, 0x0, 0x6, 0x5}, /* Silicon Image 3726, 5 ports. */ {0x47261095, 0x0, 0x7, 0x5}, /* Silicon Image 4726, 5 ports. */ {0x47231095, 0x0, 0x4, 0x2}, /* Silicon Image 4723, 2 ports. */ - NULL + 0 }; -- cgit v1.2.3 From c48c304592e7c2469d5b721291b1f57069f08d33 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 16:55:42 +0200 Subject: 10774 pcmcia: NULL pointer errors Reviewed by: Andy Stormont Approved by: Dan McDonald --- usr/src/uts/common/pcmcia/cis/cis.c | 16 ++++++------- usr/src/uts/common/pcmcia/cis/cis_handlers.c | 8 +++---- usr/src/uts/common/pcmcia/cs/cs.c | 36 ++++++++++++++-------------- usr/src/uts/common/pcmcia/nexus/pcmcia.c | 2 +- usr/src/uts/common/pcmcia/sys/cis.h | 6 ++--- 5 files changed, 31 insertions(+), 37 deletions(-) diff --git a/usr/src/uts/common/pcmcia/cis/cis.c b/usr/src/uts/common/pcmcia/cis/cis.c index 6ed1fff056..8a9ea274bd 100644 --- a/usr/src/uts/common/pcmcia/cis/cis.c +++ b/usr/src/uts/common/pcmcia/cis/cis.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This is a collection of routines that make up the Card Information * Structure (CIS) interpreter. The algorigthms used are based @@ -638,7 +636,7 @@ cis_process_longlink(cistpl_callout_t *cistpl_callout, cistpl_t *tp, cis_info->flags &= ~CW_LONGLINK_FOUND; if (cis_tuple_handler(cistpl_callout, tp, HANDTPL_PARSE_LTUPLE, - cisparse, NULL) & + cisparse, 0) & HANDTPL_ERROR) return (HANDTPL_ERROR); switch (tp->type) { @@ -890,13 +888,13 @@ cis_convert_devspeed(convert_speed_t *cs) } else if (cs->Attributes & CONVERT_DEVSPEED_TO_NS) { exponent = (cs->devspeed & (CISTPL_DEVSPEED_MAX_TBL - 1)); if ((mantissa = (((cs->devspeed)>>3) & - (CISTPL_DEVSPEED_MAX_MAN - 1))) == NULL) { - if ((cs->nS = cd->table[exponent]) == NULL) + (CISTPL_DEVSPEED_MAX_MAN - 1))) == 0) { + if ((cs->nS = cd->table[exponent]) == 0) return (CS_BAD_SPEED); return (CS_SUCCESS); } else { if ((cs->nS = ((cd->mantissa[mantissa] * - cd->exponent[exponent]) / 10)) == NULL) + cd->exponent[exponent]) / 10)) == 0) return (CS_BAD_SPEED); return (CS_SUCCESS); } @@ -1126,7 +1124,7 @@ cis_list_create(cistpl_callout_t *cistpl_callout, cs_socket_t *sp) FIND_LTUPLE_FWDF | CIS_GET_LTUPLE_IGNORE)) != NULL) { gtp->flags |= CISTPLF_IGNORE_TUPLE; - gtp = cis_get_ltuple(gtp, NULL, GET_NEXT_LTUPLEF | + gtp = cis_get_ltuple(gtp, 0, GET_NEXT_LTUPLEF | CIS_GET_LTUPLE_IGNORE); } /* while */ } /* if (cis_get_ltuple(cis[fn])) */ @@ -1284,7 +1282,7 @@ cis_create_cis_chain(cs_socket_t *sp, cistpl_callout_t *cistpl_callout, /* * Point to the last tuple in the list. */ - cis_info->cis = cis_get_ltuple(cis_info->cis, NULL, + cis_info->cis = cis_get_ltuple(cis_info->cis, 0, GET_LAST_LTUPLEF); break; case CW_LONGLINK_C_FOUND: @@ -1297,7 +1295,7 @@ cis_create_cis_chain(cs_socket_t *sp, cistpl_callout_t *cistpl_callout, /* * Point to the last tuple in the list. */ - cis_info->cis = cis_get_ltuple(cis_info->cis, NULL, + cis_info->cis = cis_get_ltuple(cis_info->cis, 0, GET_LAST_LTUPLEF); break; case CW_LONGLINK_MFC_FOUND: diff --git a/usr/src/uts/common/pcmcia/cis/cis_handlers.c b/usr/src/uts/common/pcmcia/cis/cis_handlers.c index 8f37d2a67e..5682854f8f 100644 --- a/usr/src/uts/common/pcmcia/cis/cis_handlers.c +++ b/usr/src/uts/common/pcmcia/cis/cis_handlers.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains the tuple handlers that are called by the CIS * parser. @@ -1877,7 +1875,7 @@ cistpl_linktarget_handler(cistpl_callout_t *co, cistpl_t *tp, uint32_t flags, cs->length = tl; (void) strncpy(cs->tpltg_tag, (char *)cp, cs->length); - cs->tpltg_tag[cs->length] = NULL; + cs->tpltg_tag[cs->length] = '\0'; } /* HANDTPL_PARSE_LTUPLE */ @@ -2147,7 +2145,7 @@ cis_getstr(cistpl_t *tp) while ((*cpp != 0) && (*cpp != 0xff)) cpp++; - *cpp = NULL; + *cpp = '\0'; return ((char *)cp); } @@ -2164,7 +2162,7 @@ static void cis_return_name(cistpl_callout_t *co, cistpl_get_tuple_name_t *gtn) { (void) strncpy(gtn->name, co->text, CIS_MAX_TUPLE_NAME_LEN); - gtn->name[CIS_MAX_TUPLE_NAME_LEN - 1] = NULL; + gtn->name[CIS_MAX_TUPLE_NAME_LEN - 1] = '\0'; } /* diff --git a/usr/src/uts/common/pcmcia/cs/cs.c b/usr/src/uts/common/pcmcia/cs/cs.c index c6a2b2bafd..39bc1ab77f 100644 --- a/usr/src/uts/common/pcmcia/cs/cs.c +++ b/usr/src/uts/common/pcmcia/cs/cs.c @@ -1921,9 +1921,9 @@ cs_add_client_to_socket(unsigned sn, client_handle_t *ch, * Save the DDI information. */ client->dip = cr->dip; - cr->driver_name[MODMAXNAMELEN - 1] = NULL; - client->driver_name = (char *)kmem_zalloc(strlen(cr->driver_name) + 1, - KM_SLEEP); + cr->driver_name[MODMAXNAMELEN - 1] = '\0'; + client->driver_name = kmem_zalloc(strlen(cr->driver_name) + 1, + KM_SLEEP); (void) strcpy(client->driver_name, cr->driver_name); client->instance = ddi_get_instance(cr->dip); @@ -3613,7 +3613,7 @@ cs_card_for_client(client_t *client) */ if (ddi_getprop(DDI_DEV_T_ANY, client->dip, (DDI_PROP_CANSLEEP | DDI_PROP_NOTPROM), - PCM_DEV_ACTIVE, NULL)) { + PCM_DEV_ACTIVE, 0)) { #ifdef CS_DEBUG if (cs_debug > 1) { cmn_err(CE_CONT, "cs_card_for_client: client handle 0x%x " @@ -4889,7 +4889,7 @@ cs_modify_window(window_handle_t wh, modify_win_t *mw) mw->Attributes &= ~WIN_DATA_WIDTH_VALID; - if ((error = cs_modify_mem_window(wh, mw, NULL, NULL)) != CS_SUCCESS) { + if ((error = cs_modify_mem_window(wh, mw, NULL, 0)) != CS_SUCCESS) { EVENT_THREAD_MUTEX_EXIT(client_lock_acquired, sp); mutex_exit(&cs_globals.window_lock); return (error); @@ -5670,7 +5670,7 @@ cs_request_io(client_handle_t client_handle, io_req_t *ior) ior->Attributes1)) != CS_SUCCESS) { (void) cs_setup_io_win(socket_num, client->io_alloc.Window1, - NULL, NULL, NULL, + NULL, NULL, 0, ( IO_DEALLOCATE_WINDOW | IO_DISABLE_WINDOW)); @@ -5701,7 +5701,7 @@ cs_request_io(client_handle_t client_handle, io_req_t *ior) CS_SUCCESS) { (void) cs_setup_io_win(socket_num, client->io_alloc.Window2, - NULL, NULL, NULL, + NULL, NULL, 0, ( IO_DEALLOCATE_WINDOW | IO_DISABLE_WINDOW)); @@ -5722,13 +5722,13 @@ cs_request_io(client_handle_t client_handle, io_req_t *ior) CS_SUCCESS) { (void) cs_setup_io_win(socket_num, client->io_alloc.Window1, - NULL, NULL, NULL, + NULL, NULL, 0, ( IO_DEALLOCATE_WINDOW | IO_DISABLE_WINDOW)); (void) cs_setup_io_win(socket_num, client->io_alloc.Window2, - NULL, NULL, NULL, + NULL, NULL, 0, ( IO_DEALLOCATE_WINDOW | IO_DISABLE_WINDOW)); @@ -5907,13 +5907,13 @@ cs_release_io(client_handle_t client_handle, io_req_t *ior) } else { #endif /* USE_IOMMAP_WINDOW */ (void) cs_setup_io_win(socket_num, client->io_alloc.Window1, - NULL, NULL, NULL, + NULL, NULL, 0, ( IO_DEALLOCATE_WINDOW | IO_DISABLE_WINDOW)); if (client->io_alloc.Window2 != PCMCIA_MAX_WINDOWS) (void) cs_setup_io_win(socket_num, client->io_alloc.Window2, - NULL, NULL, NULL, + NULL, NULL, 0, ( IO_DEALLOCATE_WINDOW | IO_DISABLE_WINDOW)); @@ -7366,7 +7366,7 @@ cs_get_physical_adapter_info(client_handle_t ch, cs_socket_t *sp; int client_lock_acquired; - if (ch == NULL) + if (ch == 0) gpai->PhySocket = CS_GET_SOCKET_NUMBER(gpai->LogSocket); else gpai->PhySocket = GET_CLIENT_SOCKET(ch); @@ -7375,14 +7375,14 @@ cs_get_physical_adapter_info(client_handle_t ch, * Determine if the passed socket number is valid or not. */ if ((sp = cs_get_sp(CS_GET_SOCKET_NUMBER(gpai->PhySocket))) == NULL) - return ((ch == NULL) ? CS_BAD_SOCKET : CS_BAD_HANDLE); + return ((ch == 0) ? CS_BAD_SOCKET : CS_BAD_HANDLE); EVENT_THREAD_MUTEX_ENTER(client_lock_acquired, sp); /* * If we were passed a client handle, determine if it's valid or not. */ - if (ch != NULL) { + if (ch != 0) { if (cs_find_client(ch, NULL) == NULL) { EVENT_THREAD_MUTEX_EXIT(client_lock_acquired, sp); return (CS_BAD_HANDLE); @@ -7435,7 +7435,7 @@ cs_map_log_socket(client_handle_t ch, map_log_socket_t *mls) cs_socket_t *sp; int client_lock_acquired; - if (ch == NULL) + if (ch == 0) mls->PhySocket = CS_GET_SOCKET_NUMBER(mls->LogSocket); else mls->PhySocket = GET_CLIENT_SOCKET(ch); @@ -7444,14 +7444,14 @@ cs_map_log_socket(client_handle_t ch, map_log_socket_t *mls) * Determine if the passed socket number is valid or not. */ if ((sp = cs_get_sp(CS_GET_SOCKET_NUMBER(mls->PhySocket))) == NULL) - return ((ch == NULL) ? CS_BAD_SOCKET : CS_BAD_HANDLE); + return ((ch == 0) ? CS_BAD_SOCKET : CS_BAD_HANDLE); EVENT_THREAD_MUTEX_ENTER(client_lock_acquired, sp); /* * If we were passed a client handle, determine if it's valid or not. */ - if (ch != NULL) { + if (ch != 0) { if (cs_find_client(ch, NULL) == NULL) { EVENT_THREAD_MUTEX_EXIT(client_lock_acquired, sp); return (CS_BAD_HANDLE); @@ -7567,7 +7567,7 @@ cs_event2text(event2text_t *e2t, int event_source) } /* if (cs_ss_event_text) */ } /* for (event) */ if (e2t->text[0]) - e2t->text[strlen(e2t->text)-1] = NULL; + e2t->text[strlen(e2t->text)-1] = '\0'; } /* if (!event_source) */ return (CS_SUCCESS); diff --git a/usr/src/uts/common/pcmcia/nexus/pcmcia.c b/usr/src/uts/common/pcmcia/nexus/pcmcia.c index 3cffb78316..6073b432d4 100644 --- a/usr/src/uts/common/pcmcia/nexus/pcmcia.c +++ b/usr/src/uts/common/pcmcia/nexus/pcmcia.c @@ -1152,7 +1152,7 @@ pcmcia_init_adapter(anp_t *adapter, dev_info_t *dip) pcmcia_adapters[i]->pca_number = i; (void) strcpy(pcmcia_adapters[i]->pca_name, ddi_get_name(dip)); pcmcia_adapters[i]-> - pca_name[sizeof (pcmcia_adapters[i]->pca_name) - 1] = NULL; + pca_name[sizeof (pcmcia_adapters[i]->pca_name) - 1] = '\0'; if (ls_if != NULL) { inquire_adapter_t conf; diff --git a/usr/src/uts/common/pcmcia/sys/cis.h b/usr/src/uts/common/pcmcia/sys/cis.h index cb64eac794..d1a42630b8 100644 --- a/usr/src/uts/common/pcmcia/sys/cis.h +++ b/usr/src/uts/common/pcmcia/sys/cis.h @@ -26,8 +26,6 @@ #ifndef _CIS_H #define _CIS_H -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This is the Card Services Card Information Structure (CIS) interpreter * header file. CIS information in this file is based on the @@ -90,7 +88,7 @@ extern "C" { #define CISTPL_DEVICE_OA 0x01d /* other op conditions AM device info */ #define CISTPL_DEVICEGEO 0x01e /* Common Memory device geometry */ #define CISTPL_DEVICEGEO_A 0x01f /* Attribute Memory device geometry */ -#define CISTPL_MANFID 0x020 /* manufacturer identification */ +#define CISTPL_MANFID 0x020 /* manufacturer identification */ #define CISTPL_FUNCID 0x021 /* function identification */ #define CISTPL_FUNCE 0x022 /* function extension */ @@ -216,7 +214,7 @@ typedef struct cisptr_t { #define NEXT_CIS_ADDR(ptr) \ (((ptr->flags&CISTPLF_AM_SPACE)?(ptr->offset += 2): \ (ptr->offset++)), \ - ((ptr->offset > ptr->size)?(NULL):ptr->offset)) + ((ptr->offset > ptr->size)?(0):ptr->offset)) #define GET_CIS_DATA(ptr) csx_Get8(ptr->handle, ptr->offset) #define GET_CIS_ADDR(tp) ((cisdata_t *)(uintptr_t)(tp)->offset) #define BAD_CIS_ADDR 0x080000000 /* read past end of mapped CIS error */ -- cgit v1.2.3 From 8cd1b71859be6a08c9b7a446994fdbca544bb34f Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 17:25:20 +0200 Subject: 10775 kmech_krb5: NULL pointer errors Reviewed by: Andy Stormont Approved by: Dan McDonald --- .../common/gssapi/mechs/krb5/crypto/cksumtypes.c | 26 +++++++++++----------- .../uts/common/gssapi/mechs/krb5/crypto/etypes.c | 26 +++++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/usr/src/uts/common/gssapi/mechs/krb5/crypto/cksumtypes.c b/usr/src/uts/common/gssapi/mechs/krb5/crypto/cksumtypes.c index 43c42bd629..9ebf2464e2 100644 --- a/usr/src/uts/common/gssapi/mechs/krb5/crypto/cksumtypes.c +++ b/usr/src/uts/common/gssapi/mechs/krb5/crypto/cksumtypes.c @@ -6,14 +6,14 @@ /* * Copyright (C) 1998 by the FundsXpress, INC. - * + * * All rights reserved. - * + * * Export of this software from the United States of America may require * a specific license from the United States Government. It is the * responsibility of any person or organization contemplating export to * obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -24,7 +24,7 @@ * permission. FundsXpress makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. @@ -38,7 +38,7 @@ const struct krb5_cksumtypes krb5_cksumtypes_list[] = { { CKSUMTYPE_CRC32, KRB5_CKSUMFLAG_NOT_COLL_PROOF, "crc32", "CRC-32", - NULL, NULL, &krb5int_hash_crc32, 0, + 0, NULL, &krb5int_hash_crc32, 0, #ifdef _KERNEL NULL, CRYPTO_MECH_INVALID @@ -48,7 +48,7 @@ const struct krb5_cksumtypes krb5_cksumtypes_list[] = { { CKSUMTYPE_DESCBC, 0, "des-cbc", "DES cbc mode", ENCTYPE_DES_CBC_CRC, &krb5int_keyhash_descbc, - NULL, NULL, + 0, 0, #ifdef _KERNEL NULL, CRYPTO_MECH_INVALID @@ -57,7 +57,7 @@ const struct krb5_cksumtypes krb5_cksumtypes_list[] = { { CKSUMTYPE_RSA_MD5, 0, "md5", "RSA-MD5", - NULL, NULL, &krb5int_hash_md5, 0, + 0, NULL, &krb5int_hash_md5, 0, #ifdef _KERNEL SUN_CKM_MD5, CRYPTO_MECH_INVALID @@ -66,7 +66,7 @@ const struct krb5_cksumtypes krb5_cksumtypes_list[] = { { CKSUMTYPE_RSA_MD5_DES, 0, "md5-des", "RSA-MD5 with DES cbc mode", ENCTYPE_DES_CBC_CRC, &krb5int_keyhash_md5des, - NULL, NULL, + 0, 0, #ifdef _KERNEL SUN_CKM_MD5, CRYPTO_MECH_INVALID @@ -75,7 +75,7 @@ const struct krb5_cksumtypes krb5_cksumtypes_list[] = { { CKSUMTYPE_NIST_SHA, 0, "sha", "NIST-SHA", - NULL, NULL, &krb5int_hash_sha1, 0, + 0, NULL, &krb5int_hash_sha1, 0, #ifdef _KERNEL SUN_CKM_SHA1, CRYPTO_MECH_INVALID @@ -84,7 +84,7 @@ const struct krb5_cksumtypes krb5_cksumtypes_list[] = { { CKSUMTYPE_HMAC_SHA1_DES3, KRB5_CKSUMFLAG_DERIVE, "hmac-sha1-des3", "HMAC-SHA1 DES3 key", - NULL, NULL, &krb5int_hash_sha1, 0, + 0, NULL, &krb5int_hash_sha1, 0, #ifdef _KERNEL SUN_CKM_SHA1_HMAC, CRYPTO_MECH_INVALID @@ -92,14 +92,14 @@ const struct krb5_cksumtypes krb5_cksumtypes_list[] = { }, { CKSUMTYPE_HMAC_SHA1_DES3, KRB5_CKSUMFLAG_DERIVE, "hmac-sha1-des3-kd", "HMAC-SHA1 DES3 key", /* alias */ - NULL, NULL, &krb5int_hash_sha1, 0, + 0, NULL, &krb5int_hash_sha1, 0, #ifdef _KERNEL SUN_CKM_SHA1_HMAC, CRYPTO_MECH_INVALID #endif /* _KERNEL */ }, { CKSUMTYPE_HMAC_MD5_ARCFOUR, 0, - "hmac-md5-rc4", "Microsoft HMAC MD5 (RC4 key)", + "hmac-md5-rc4", "Microsoft HMAC MD5 (RC4 key)", ENCTYPE_ARCFOUR_HMAC, &krb5int_keyhash_hmac_md5, NULL, 0, #ifdef _KERNEL @@ -128,7 +128,7 @@ const struct krb5_cksumtypes krb5_cksumtypes_list[] = { { CKSUMTYPE_HMAC_SHA1_96_AES128, KRB5_CKSUMFLAG_DERIVE, "hmac-sha1-96-aes128", "HMAC-SHA1 AES128 key", - NULL, NULL, &krb5int_hash_sha1, 12, + 0, NULL, &krb5int_hash_sha1, 12, #ifdef _KERNEL SUN_CKM_SHA1_HMAC, CRYPTO_MECH_INVALID diff --git a/usr/src/uts/common/gssapi/mechs/krb5/crypto/etypes.c b/usr/src/uts/common/gssapi/mechs/krb5/crypto/etypes.c index 7566a0e036..130a8ba8c1 100644 --- a/usr/src/uts/common/gssapi/mechs/krb5/crypto/etypes.c +++ b/usr/src/uts/common/gssapi/mechs/krb5/crypto/etypes.c @@ -6,14 +6,14 @@ /* * Copyright (C) 1998 by the FundsXpress, INC. - * + * * All rights reserved. - * + * * Export of this software from the United States of America may require * a specific license from the United States Government. It is the * responsibility of any person or organization contemplating export to * obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -24,7 +24,7 @@ * permission. FundsXpress makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. @@ -37,7 +37,7 @@ #define krb5int_des_string_to_key NULL #define krb5_dk_string_to_key NULL #define krb5int_arcfour_string_to_key NULL -#endif /* _KERNEL */ +#endif /* _KERNEL */ #include #include @@ -102,7 +102,7 @@ struct krb5_keytypes krb5_enctypes_list[] = { "des-cbc-raw", "DES cbc mode raw", &krb5int_enc_des, NULL, krb5_raw_encrypt_length, krb5_raw_encrypt, krb5_raw_decrypt, - NULL, + 0, #ifndef _KERNEL krb5int_des_string_to_key, #else @@ -117,7 +117,7 @@ struct krb5_keytypes krb5_enctypes_list[] = { "des3-cbc-raw", "Triple DES cbc mode raw", &krb5int_enc_des3, NULL, krb5_raw_encrypt_length, krb5_raw_encrypt, krb5_raw_decrypt, - NULL, + 0, #ifndef _KERNEL krb5int_dk_string_to_key, #else @@ -192,7 +192,7 @@ struct krb5_keytypes krb5_enctypes_list[] = { "des-hmac-sha1", "DES with HMAC/sha1", &krb5int_enc_des, &krb5int_hash_sha1, krb5_dk_encrypt_length, krb5_dk_encrypt, krb5_dk_decrypt, - NULL, + 0, #ifndef _KERNEL krb5int_dk_string_to_key, #else @@ -221,7 +221,7 @@ krb5_arcfour_encrypt_length, krb5_arcfour_encrypt, "rc4-hmac", "ArcFour with HMAC/md5", &krb5int_enc_arcfour, &krb5int_hash_md5, krb5_arcfour_encrypt_length, krb5_arcfour_encrypt, - krb5_arcfour_decrypt, + krb5_arcfour_decrypt, CKSUMTYPE_HMAC_MD5_ARCFOUR, #ifndef _KERNEL krb5int_arcfour_string_to_key, @@ -395,7 +395,7 @@ setup_kef_keytypes() crypto_mech_type_t get_cipher_mech_type(krb5_context context, krb5_keyblock *key) { - int i; + int i; struct krb5_keytypes *kt; if (key == NULL) @@ -411,14 +411,14 @@ get_cipher_mech_type(krb5_context context, krb5_keyblock *key) return (kt->kef_cipher_mt); } } - return (CRYPTO_MECH_INVALID); + return (CRYPTO_MECH_INVALID); } /*ARGSUSED*/ crypto_mech_type_t get_hash_mech_type(krb5_context context, krb5_keyblock *key) { - int i; + int i; struct krb5_keytypes *kt; if (key == NULL) @@ -434,7 +434,7 @@ get_hash_mech_type(krb5_context context, krb5_keyblock *key) return (kt->kef_hash_mt); } } - return (CRYPTO_MECH_INVALID); + return (CRYPTO_MECH_INVALID); } #endif /* _KERNEL */ -- cgit v1.2.3 From 2002b186f847595188b1fb0b8dd800370aa6107c Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 21:12:47 +0200 Subject: 10791 dr: NULL pointer errors Reviewed by: Sebastian Wiedenroth Reviewed by: Robert Mustacchi Approved by: Dan McDonald --- usr/src/uts/i86pc/io/dr/dr.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/usr/src/uts/i86pc/io/dr/dr.c b/usr/src/uts/i86pc/io/dr/dr.c index 302d07f5bd..65cc469d71 100644 --- a/usr/src/uts/i86pc/io/dr/dr.c +++ b/usr/src/uts/i86pc/io/dr/dr.c @@ -554,7 +554,7 @@ int dr_enable = 1; /*ARGSUSED3*/ static int dr_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, - cred_t *cred_p, int *rval_p) + cred_t *cred_p, int *rval_p) { int rv = 0; int instance; @@ -704,7 +704,7 @@ dr_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) { int rv, rv2; int bd; - int instance; + int instance; sbd_error_t *err; dr_softstate_t *softsp; @@ -764,7 +764,7 @@ dr_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) minor_num = DR_MAKE_MINOR(instance, bd); rv = ddi_create_minor_node(dip, name, S_IFCHR, - minor_num, DDI_NT_SBD_ATTACHMENT_POINT, NULL); + minor_num, DDI_NT_SBD_ATTACHMENT_POINT, 0); if (rv != DDI_SUCCESS) rv = DDI_FAILURE; } @@ -802,7 +802,7 @@ dr_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) static int dr_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { - int instance; + int instance; dr_softstate_t *softsp; switch (cmd) { @@ -1550,7 +1550,7 @@ dr_dev_is_target(dr_dev_unit_t *dp, int present_only, uint_t uset) static void dr_dev_make_list(dr_handle_t *hp, sbd_comp_type_t type, int present_only, - dr_common_unit_t ***devlist, int *devnum) + dr_common_unit_t ***devlist, int *devnum) { dr_board_t *bp = hp->h_bd; int unum; @@ -1670,10 +1670,10 @@ dr_dev_clean_up(dr_handle_t *hp, dr_common_unit_t **list, int devnum) static int dr_dev_walk(dr_handle_t *hp, sbd_comp_type_t type, int present_only, - int (*pre_op)(dr_handle_t *, dr_common_unit_t **, int), - void (*op)(dr_handle_t *, dr_common_unit_t *), - int (*post_op)(dr_handle_t *, dr_common_unit_t **, int), - void (*board_op)(dr_handle_t *, dr_common_unit_t **, int)) + int (*pre_op)(dr_handle_t *, dr_common_unit_t **, int), + void (*op)(dr_handle_t *, dr_common_unit_t *), + int (*post_op)(dr_handle_t *, dr_common_unit_t **, int), + void (*board_op)(dr_handle_t *, dr_common_unit_t **, int)) { int devnum, rv; dr_common_unit_t **devlist; @@ -1708,7 +1708,7 @@ dr_dev_noop(dr_handle_t *hp, dr_common_unit_t **devlist, int devnum) static void dr_attach_update_state(dr_handle_t *hp, - dr_common_unit_t **devlist, int devnum) + dr_common_unit_t **devlist, int devnum) { dr_board_t *bp = hp->h_bd; int i; @@ -1809,7 +1809,7 @@ dr_dev_configure(dr_handle_t *hp) static void dr_release_update_state(dr_handle_t *hp, - dr_common_unit_t **devlist, int devnum) + dr_common_unit_t **devlist, int devnum) { _NOTE(ARGUNUSED(devlist)) _NOTE(ARGUNUSED(devnum)) @@ -1933,7 +1933,7 @@ dr_dev_release(dr_handle_t *hp) static void dr_detach_update_state(dr_handle_t *hp, - dr_common_unit_t **devlist, int devnum) + dr_common_unit_t **devlist, int devnum) { dr_board_t *bp = hp->h_bd; int i; @@ -2656,7 +2656,7 @@ dr_nt_to_dev_type(int nt) */ static int dr_check_transition(dr_board_t *bp, dr_devset_t *devsetp, - struct dr_state_trans *transp, int cmd) + struct dr_state_trans *transp, int cmd) { int s, ut; int state_err = 0; -- cgit v1.2.3 From 296f12dc4bd61fe5e3b1200d2cdf217ed82119a1 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 20 Jan 2019 22:13:06 +0200 Subject: 10792 pcie: NULL pointer errors Reviewed by: Robert Mustacchi Reviewed by: Patrick Mooney Approved by: Dan McDonald --- usr/src/uts/common/io/pciex/hotplug/pcishpc.c | 10 ++--- usr/src/uts/common/io/pciex/pcie.c | 12 +++--- usr/src/uts/common/io/pciex/pcie_fault.c | 60 ++++++++++++++++----------- usr/src/uts/common/io/pciex/pciev.c | 10 ++--- usr/src/uts/common/sys/pciev.h | 2 +- 5 files changed, 52 insertions(+), 42 deletions(-) diff --git a/usr/src/uts/common/io/pciex/hotplug/pcishpc.c b/usr/src/uts/common/io/pciex/hotplug/pcishpc.c index 98aa69e140..22e7418096 100644 --- a/usr/src/uts/common/io/pciex/hotplug/pcishpc.c +++ b/usr/src/uts/common/io/pciex/hotplug/pcishpc.c @@ -367,10 +367,10 @@ pcishpc_slot_get_property(pcie_hp_slot_t *slot_p, ddi_hp_property_t *arg, ddi_hp_property32_t request32, result32; #endif pcie_hp_ctrl_t *ctrl_p = slot_p->hs_ctrl; - nvlist_t *prop_list; + nvlist_t *prop_list; nvlist_t *prop_rlist; /* nvlist for return values */ - nvpair_t *prop_pair; - char *name, *value; + nvpair_t *prop_pair; + char *name, *value; int ret = DDI_SUCCESS; int i, n; boolean_t get_all_prop = B_FALSE; @@ -1920,7 +1920,7 @@ pcishpc_set_slot_name(pcie_hp_ctrl_t *ctrl_p, int slot) /* * construct the slot_name: - * if "slot-names" property exists then use that name + * if "slot-names" property exists then use that name * else if valid slot number exists then it is "pci". * else it will be "pcidev" */ @@ -1968,7 +1968,7 @@ pcishpc_set_slot_name(pcie_hp_ctrl_t *ctrl_p, int slot) * before ours. */ while (slots_before) { - while (*s != NULL) + while (*s != '\0') s++; s++; slots_before--; diff --git a/usr/src/uts/common/io/pciex/pcie.c b/usr/src/uts/common/io/pciex/pcie.c index 95eaa5837f..4ea5cd9778 100644 --- a/usr/src/uts/common/io/pciex/pcie.c +++ b/usr/src/uts/common/io/pciex/pcie.c @@ -932,7 +932,7 @@ void pcie_rc_fini_bus(dev_info_t *dip) { pcie_bus_t *bus_p = PCIE_DIP2DOWNBUS(dip); - ndi_set_bus_private(dip, B_FALSE, NULL, NULL); + ndi_set_bus_private(dip, B_FALSE, 0, NULL); kmem_free(PCIE_BUS2DOM(bus_p), sizeof (pcie_domain_t)); kmem_free(bus_p, sizeof (pcie_bus_t)); } @@ -1270,7 +1270,7 @@ pcie_fini_bus(dev_info_t *dip, uint8_t flags) "hotplug-capable"); } - ndi_set_bus_private(dip, B_TRUE, NULL, NULL); + ndi_set_bus_private(dip, B_TRUE, 0, NULL); kmem_free(bus_p, sizeof (pcie_bus_t)); } } @@ -1798,7 +1798,7 @@ pcie_init_root_port_mps(dev_info_t *dip) (void) pcie_get_fabric_mps(ddi_get_parent(dip), ddi_get_child(dip), &max_supported); - rp_cap = PCI_CAP_GET16(bus_p->bus_cfg_hdl, NULL, + rp_cap = PCI_CAP_GET16(bus_p->bus_cfg_hdl, 0, bus_p->bus_pcie_off, PCIE_DEVCAP) & PCIE_DEVCAP_MAX_PAYLOAD_MASK; @@ -1991,7 +1991,7 @@ pcie_get_max_supported(dev_info_t *dip, void *arg) goto fail3; } - max_supported = PCI_CAP_GET16(config_handle, NULL, cap_ptr, + max_supported = PCI_CAP_GET16(config_handle, 0, cap_ptr, PCIE_DEVCAP) & PCIE_DEVCAP_MAX_PAYLOAD_MASK; PCIE_DBG("PCIE MPS: %s: MPS Capabilities %x\n", ddi_driver_name(dip), @@ -2039,7 +2039,7 @@ pcie_root_port(dev_info_t *dip) continue; } - port_type = PCI_CAP_GET16(config_handle, NULL, cap_ptr, + port_type = PCI_CAP_GET16(config_handle, 0, cap_ptr, PCIE_PCIECAP) & PCIE_PCIECAP_DEV_TYPE_MASK; pci_config_teardown(&config_handle); @@ -2349,7 +2349,7 @@ pcie_ari_get_next_function(dev_info_t *dip, int *func) return (DDI_FAILURE); } - val = PCI_CAP_GET32(handle, NULL, cap_ptr, PCIE_ARI_CAP); + val = PCI_CAP_GET32(handle, 0, cap_ptr, PCIE_ARI_CAP); next_function = (val >> PCIE_ARI_CAP_NEXT_FUNC_SHIFT) & PCIE_ARI_CAP_NEXT_FUNC_MASK; diff --git a/usr/src/uts/common/io/pciex/pcie_fault.c b/usr/src/uts/common/io/pciex/pcie_fault.c index f4a2e9190e..a8c02caa9c 100644 --- a/usr/src/uts/common/io/pciex/pcie_fault.c +++ b/usr/src/uts/common/io/pciex/pcie_fault.c @@ -164,7 +164,8 @@ int pcie_disable_scan = 0; /* Disable fabric scan */ /* Inform interested parties that error handling is about to begin. */ /* ARGSUSED */ void -pf_eh_enter(pcie_bus_t *bus_p) { +pf_eh_enter(pcie_bus_t *bus_p) +{ } /* Inform interested parties that error handling has ended. */ @@ -304,7 +305,8 @@ done: } void -pcie_force_fullscan() { +pcie_force_fullscan(void) +{ pcie_full_scan = B_TRUE; } @@ -1185,7 +1187,7 @@ const pf_fab_err_tbl_t pcie_pcie_tbl[] = { {PCIE_AER_UCE_UR, pf_analyse_ca_ur, PF_AFFECTED_SELF, 0}, - {NULL, NULL, NULL, NULL} + {0, NULL, 0, 0} }; const pf_fab_err_tbl_t pcie_rp_tbl[] = { @@ -1226,7 +1228,7 @@ const pf_fab_err_tbl_t pcie_rp_tbl[] = { {PCIE_AER_UCE_UR, pf_no_panic, PF_AFFECTED_AER, PF_AFFECTED_CHILDREN}, - {NULL, NULL, NULL, NULL} + {0, NULL, 0, 0} }; const pf_fab_err_tbl_t pcie_sw_tbl[] = { @@ -1267,7 +1269,7 @@ const pf_fab_err_tbl_t pcie_sw_tbl[] = { {PCIE_AER_UCE_UR, pf_analyse_ca_ur, PF_AFFECTED_AER, PF_AFFECTED_SELF | PF_AFFECTED_CHILDREN}, - {NULL, NULL, NULL, NULL} + {0, NULL, 0, 0} }; const pf_fab_err_tbl_t pcie_pcie_bdg_tbl[] = { @@ -1310,7 +1312,7 @@ const pf_fab_err_tbl_t pcie_pcie_bdg_tbl[] = { {PCIE_AER_SUCE_INTERNAL_ERR, pf_panic, PF_AFFECTED_SELF | PF_AFFECTED_CHILDREN, 0}, - {NULL, NULL, NULL, NULL} + {0, NULL, 0, 0} }; const pf_fab_err_tbl_t pcie_pci_bdg_tbl[] = { @@ -1332,7 +1334,7 @@ const pf_fab_err_tbl_t pcie_pci_bdg_tbl[] = { {PCI_STAT_S_TARG_AB, pf_analyse_pci, PF_AFFECTED_SELF, 0}, - {NULL, NULL, NULL, NULL} + {0, NULL, 0, 0} }; const pf_fab_err_tbl_t pcie_pci_tbl[] = { @@ -1354,7 +1356,7 @@ const pf_fab_err_tbl_t pcie_pci_tbl[] = { {PCI_STAT_S_TARG_AB, pf_analyse_pci, PF_AFFECTED_SELF, 0}, - {NULL, NULL, NULL, NULL} + {0, NULL, 0, 0} }; #define PF_MASKED_AER_ERR(pfd_p) \ @@ -1470,7 +1472,7 @@ pf_analyse_error_tbl(ddi_fm_error_t *derr, pf_impl_t *impl, uint16_t flags; uint32_t bit; - for (row = tbl; err_reg && (row->bit != NULL); row++) { + for (row = tbl; err_reg && (row->bit != 0); row++) { bit = row->bit; if (!(err_reg & bit)) continue; @@ -2165,7 +2167,8 @@ pf_matched_in_rc(pf_data_t *dq_head_p, pf_data_t *pfd_p, */ static void pf_pci_find_trans_type(pf_data_t *pfd_p, uint64_t *addr, uint32_t *trans_type, - pcie_req_id_t *bdf) { + pcie_req_id_t *bdf) +{ pf_data_t *rc_pfd_p; /* Could be DMA or PIO. Find out by look at error type. */ @@ -2216,7 +2219,8 @@ pf_pci_find_trans_type(pf_data_t *pfd_p, uint64_t *addr, uint32_t *trans_type, */ /* ARGSUSED */ int -pf_pci_decode(pf_data_t *pfd_p, uint16_t *cmd) { +pf_pci_decode(pf_data_t *pfd_p, uint16_t *cmd) +{ pcix_attr_t *attr; uint64_t addr; uint32_t trans_type; @@ -2299,7 +2303,7 @@ pf_hdl_lookup(dev_info_t *dip, uint64_t ena, uint32_t flag, uint64_t addr, ddi_fm_error_t derr; /* If we don't know the addr or rid just return with NOTFOUND */ - if ((addr == NULL) && !PCIE_CHECK_VALID_BDF(bdf)) + if ((addr == 0) && !PCIE_CHECK_VALID_BDF(bdf)) return (PF_HDL_NOTFOUND); /* @@ -2415,7 +2419,8 @@ done: static int pf_hdl_compare(dev_info_t *dip, ddi_fm_error_t *derr, uint32_t flag, - uint64_t addr, pcie_req_id_t bdf, ndi_fmc_t *fcp) { + uint64_t addr, pcie_req_id_t bdf, ndi_fmc_t *fcp) +{ ndi_fmcentry_t *fep; int found = 0; int status; @@ -2430,17 +2435,21 @@ pf_hdl_compare(dev_info_t *dip, ddi_fm_error_t *derr, uint32_t flag, * subsequent error handling, we block * attempts to free the cache entry. */ - compare_func = (flag == ACC_HANDLE) ? - i_ddi_fm_acc_err_cf_get((ddi_acc_handle_t) - fep->fce_resource) : - i_ddi_fm_dma_err_cf_get((ddi_dma_handle_t) - fep->fce_resource); + if (flag == ACC_HANDLE) { + compare_func = + i_ddi_fm_acc_err_cf_get((ddi_acc_handle_t) + fep->fce_resource); + } else { + compare_func = + i_ddi_fm_dma_err_cf_get((ddi_dma_handle_t) + fep->fce_resource); + } if (compare_func == NULL) /* unbound or not FLAGERR */ continue; status = compare_func(dip, fep->fce_resource, - (void *)&addr, (void *)&bdf); + (void *)&addr, (void *)&bdf); if (status == DDI_FM_NONFATAL) { found++; @@ -2469,7 +2478,7 @@ pf_hdl_compare(dev_info_t *dip, ddi_fm_error_t *derr, uint32_t flag, * If a handler isn't found and we know this is the right device mark * them all failed. */ - if ((addr != NULL) && PCIE_CHECK_VALID_BDF(bdf) && (found == 0)) { + if ((addr != 0) && PCIE_CHECK_VALID_BDF(bdf) && (found == 0)) { status = pf_hdl_compare(dip, derr, flag, addr, bdf, fcp); if (status == PF_HDL_FOUND) found++; @@ -2490,7 +2499,7 @@ pf_hdl_compare(dev_info_t *dip, ddi_fm_error_t *derr, uint32_t flag, /* ARGSUSED */ static int pf_log_hdl_lookup(dev_info_t *rpdip, ddi_fm_error_t *derr, pf_data_t *pfd_p, - boolean_t is_primary) + boolean_t is_primary) { /* * Disabling this function temporarily until errors can be handled @@ -2537,7 +2546,8 @@ pf_log_hdl_lookup(dev_info_t *rpdip, ddi_fm_error_t *derr, pf_data_t *pfd_p, * accessed via the bus_p. */ int -pf_tlp_decode(pcie_bus_t *bus_p, pf_pcie_adv_err_regs_t *adv_reg_p) { +pf_tlp_decode(pcie_bus_t *bus_p, pf_pcie_adv_err_regs_t *adv_reg_p) +{ pcie_tlp_hdr_t *tlp_hdr = (pcie_tlp_hdr_t *)adv_reg_p->pcie_ue_hdr; pcie_req_id_t my_bdf, tlp_bdf, flt_bdf = PCIE_INVALID_BDF; uint64_t flt_addr = 0; @@ -2572,7 +2582,7 @@ pf_tlp_decode(pcie_bus_t *bus_p, pf_pcie_adv_err_regs_t *adv_reg_p) { flt_bdf = tlp_bdf; } else if (PCIE_IS_ROOT(bus_p) && (PF_FIRST_AER_ERR(PCIE_AER_UCE_PTLP, adv_reg_p) || - (PF_FIRST_AER_ERR(PCIE_AER_UCE_CA, adv_reg_p)))) { + (PF_FIRST_AER_ERR(PCIE_AER_UCE_CA, adv_reg_p)))) { flt_trans_type = PF_ADDR_DMA; flt_bdf = tlp_bdf; } else { @@ -2591,7 +2601,7 @@ pf_tlp_decode(pcie_bus_t *bus_p, pf_pcie_adv_err_regs_t *adv_reg_p) { { pcie_cpl_t *cpl_tlp = (pcie_cpl_t *)&adv_reg_p->pcie_ue_hdr[1]; - flt_addr = NULL; + flt_addr = 0; flt_bdf = (cpl_tlp->rid > cpl_tlp->cid) ? cpl_tlp->rid : cpl_tlp->cid; @@ -3220,7 +3230,7 @@ pf_find_busp_by_saer(pf_impl_t *impl, pf_data_t *pfd_p) addr = reg_p->pcie_sue_tgt_addr; bdf = reg_p->pcie_sue_tgt_bdf; - if (addr != NULL) { + if (addr != 0) { temp_bus_p = pf_find_busp_by_addr(impl, addr); } else if (PCIE_CHECK_VALID_BDF(bdf)) { temp_bus_p = pf_find_busp_by_bdf(impl, bdf); diff --git a/usr/src/uts/common/io/pciex/pciev.c b/usr/src/uts/common/io/pciex/pciev.c index b442aae5b5..18794318dd 100644 --- a/usr/src/uts/common/io/pciex/pciev.c +++ b/usr/src/uts/common/io/pciex/pciev.c @@ -124,8 +124,8 @@ pcie_bdf_list_remove(pcie_req_id_t bdf, pcie_req_id_list_t **rlist_p) void pcie_cache_domain_info(pcie_bus_t *bus_p) { - boolean_t assigned = PCIE_IS_ASSIGNED(bus_p); - boolean_t fma_dom = PCIE_ASSIGNED_TO_FMA_DOM(bus_p); + boolean_t assigned = PCIE_IS_ASSIGNED(bus_p); + boolean_t fma_dom = PCIE_ASSIGNED_TO_FMA_DOM(bus_p); uint_t domain_id = PCIE_DOMAIN_ID_GET(bus_p); pcie_req_id_t bdf = bus_p->bus_bdf; dev_info_t *pdip; @@ -163,8 +163,8 @@ pcie_cache_domain_info(pcie_bus_t *bus_p) void pcie_uncache_domain_info(pcie_bus_t *bus_p) { - boolean_t assigned = PCIE_IS_ASSIGNED(bus_p); - boolean_t fma_dom = PCIE_ASSIGNED_TO_FMA_DOM(bus_p); + boolean_t assigned = PCIE_IS_ASSIGNED(bus_p); + boolean_t fma_dom = PCIE_ASSIGNED_TO_FMA_DOM(bus_p); uint_t domain_id = PCIE_DOMAIN_ID_GET(bus_p); pcie_domain_t *dom_p = PCIE_BUS2DOM(bus_p), *pdom_p; pcie_bus_t *pbus_p; @@ -176,7 +176,7 @@ pcie_uncache_domain_info(pcie_bus_t *bus_p) /* Clear the domain information */ if (domain_id) { - PCIE_DOMAIN_ID_SET(bus_p, NULL); + PCIE_DOMAIN_ID_SET(bus_p, 0); PCIE_DOMAIN_ID_DECR_REF_COUNT(bus_p); } diff --git a/usr/src/uts/common/sys/pciev.h b/usr/src/uts/common/sys/pciev.h index 89b6b1dfa7..256a68a7b4 100644 --- a/usr/src/uts/common/sys/pciev.h +++ b/usr/src/uts/common/sys/pciev.h @@ -154,7 +154,7 @@ extern void pcie_fini_dom(dev_info_t *); /* Following macros are only valid for leaf devices */ #define PCIE_DOMAIN_ID_GET(bus_p) \ ((uint_t)(PCIE_IS_ASSIGNED(bus_p) \ - ? PCIE_BUS2DOM(bus_p)->domain.id.domain_id : NULL)) + ? PCIE_BUS2DOM(bus_p)->domain.id.domain_id : 0)) #define PCIE_DOMAIN_ID_SET(bus_p, new_id) \ if (!PCIE_IS_BDG(bus_p)) \ PCIE_BUS2DOM(bus_p)->domain.id.domain_id = (uint_t)(new_id) -- cgit v1.2.3