diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-20 16:55:42 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-04-24 09:50:36 +0300 |
commit | c48c304592e7c2469d5b721291b1f57069f08d33 (patch) | |
tree | f71bd35e8710024a9ef09d5769c377d1d1a7631f | |
parent | b38836b5d7f7e27aad97495457921171be74e408 (diff) | |
download | illumos-joyent-c48c304592e7c2469d5b721291b1f57069f08d33.tar.gz |
10774 pcmcia: NULL pointer errors
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/uts/common/pcmcia/cis/cis.c | 16 | ||||
-rw-r--r-- | usr/src/uts/common/pcmcia/cis/cis_handlers.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/pcmcia/cs/cs.c | 36 | ||||
-rw-r--r-- | usr/src/uts/common/pcmcia/nexus/pcmcia.c | 2 | ||||
-rw-r--r-- | 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 */ |