From 0e8cce457763b131de48395a9beed889fd529c1f Mon Sep 17 00:00:00 2001 From: "Chas Williams (CONTRACTOR)" Date: Tue, 19 Oct 2010 14:50:35 -0400 Subject: [PATCH] afs: clean afs_osi_Alloc() usage Add asserts for any failures cases not explicitly handled and remove any casting. Change-Id: I282d917ab84b37012553233f2c913b2aef1c92e2 Reviewed-on: http://gerrit.openafs.org/3012 Reviewed-by: Simon Wilkinson Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/afs/AIX/osi_vcache.c | 3 ++- src/afs/DARWIN/osi_vcache.c | 3 ++- src/afs/LINUX/osi_nfssrv.c | 1 + src/afs/LINUX24/osi_vcache.c | 1 + src/afs/SOLARIS/osi_vcache.c | 6 ++++- src/afs/VNOPS/afs_vnop_symlink.c | 5 +++- src/afs/afs_analyze.c | 1 + src/afs/afs_axscache.c | 1 + src/afs/afs_buffer.c | 10 ++++---- src/afs/afs_call.c | 11 +++++++++ src/afs/afs_callback.c | 20 +++++++++------- src/afs/afs_cell.c | 9 ++++--- src/afs/afs_conn.c | 3 ++- src/afs/afs_dcache.c | 40 ++++++++++++++++++-------------- src/afs/afs_disconnected.c | 4 ++-- src/afs/afs_dynroot.c | 13 +++++++++++ src/afs/afs_exporter.c | 3 ++- src/afs/afs_icl.c | 9 +++---- src/afs/afs_init.c | 7 ++++-- src/afs/afs_memcache.c | 3 ++- src/afs/afs_nfsclnt.c | 4 +++- src/afs/afs_osi_alloc.c | 2 +- src/afs/afs_pag_call.c | 4 +++- src/afs/afs_pag_cred.c | 7 +++--- src/afs/afs_pioctl.c | 6 ++++- src/afs/afs_segments.c | 2 +- src/afs/afs_server.c | 29 ++++++++++++++--------- src/afs/afs_tokens.c | 2 ++ src/afs/afs_user.c | 3 ++- src/afs/afs_util.c | 2 +- src/afs/afs_vcache.c | 9 +++---- src/afs/afs_volume.c | 7 ++++-- 32 files changed, 155 insertions(+), 75 deletions(-) diff --git a/src/afs/AIX/osi_vcache.c b/src/afs/AIX/osi_vcache.c index a18e74df5..1c99d73c7 100644 --- a/src/afs/AIX/osi_vcache.c +++ b/src/afs/AIX/osi_vcache.c @@ -31,7 +31,8 @@ struct vcache * osi_NewVnode(void) { struct vcache *tvc; - tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache)); + tvc = afs_osi_Alloc(sizeof(struct vcache)); + osi_Assert(tvc != NULL); #ifdef KERNEL_HAVE_PIN pin((char *)tvc, sizeof(struct vcache)); /* XXX */ diff --git a/src/afs/DARWIN/osi_vcache.c b/src/afs/DARWIN/osi_vcache.c index 6a7dbcd04..4f2e5a87c 100644 --- a/src/afs/DARWIN/osi_vcache.c +++ b/src/afs/DARWIN/osi_vcache.c @@ -17,7 +17,8 @@ struct vcache * osi_NewVnode(void) { struct vcache *tvc; - tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache)); + tvc = afs_osi_Alloc(sizeof(struct vcache)); + osi_Assert(tvc != NULL); tvc->v = NULL; /* important to clean this, or use memset 0 */ return tvc; diff --git a/src/afs/LINUX/osi_nfssrv.c b/src/afs/LINUX/osi_nfssrv.c index 4c0553bc4..010f830f1 100644 --- a/src/afs/LINUX/osi_nfssrv.c +++ b/src/afs/LINUX/osi_nfssrv.c @@ -224,6 +224,7 @@ void osi_linux_nfssrv_init(void) } afs_new_authtab[i] = afs_osi_Alloc(sizeof(struct auth_ops)); + osi_Assert(afs_new_authtab[i] != NULL); *(afs_new_authtab[i]) = *(afs_orig_authtab[i]); afs_new_authtab[i]->owner = THIS_MODULE; afs_new_authtab[i]->accept = svcauth_afs_accept; diff --git a/src/afs/LINUX24/osi_vcache.c b/src/afs/LINUX24/osi_vcache.c index 7de037dc3..e3e3003ef 100644 --- a/src/afs/LINUX24/osi_vcache.c +++ b/src/afs/LINUX24/osi_vcache.c @@ -86,6 +86,7 @@ osi_NewVnode(void) tvc = VTOAFS(ip); #else tvc = afs_osi_Alloc(sizeof(struct vcache)); + osi_Assert(tvc != NULL); ip->u.generic_ip = tvc; tvc->v = ip; #endif diff --git a/src/afs/SOLARIS/osi_vcache.c b/src/afs/SOLARIS/osi_vcache.c index 7435ed3ec..2bb8f26ec 100644 --- a/src/afs/SOLARIS/osi_vcache.c +++ b/src/afs/SOLARIS/osi_vcache.c @@ -28,7 +28,11 @@ osi_TryEvictVCache(struct vcache *avc, int *slept) { struct vcache * osi_NewVnode(void) { - return (struct vcache *)afs_osi_Alloc(sizeof(struct vcache)); + struct vcache *avc; + + avc = afs_osi_Alloc(sizeof(struct vcache)); + osi_Assert(avc != NULL); + return avc; } void diff --git a/src/afs/VNOPS/afs_vnop_symlink.c b/src/afs/VNOPS/afs_vnop_symlink.c index 73f208670..dbbf9c84b 100644 --- a/src/afs/VNOPS/afs_vnop_symlink.c +++ b/src/afs/VNOPS/afs_vnop_symlink.c @@ -276,7 +276,8 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, } if (!tvc->linkData) { - tvc->linkData = (char *)afs_osi_Alloc(alen); + tvc->linkData = afs_osi_Alloc(alen); + osi_Assert(tvc->linkData != NULL); strncpy(tvc->linkData, atargetName, alen - 1); tvc->linkData[alen - 1] = 0; } @@ -333,6 +334,7 @@ afs_MemHandleLink(struct vcache *avc, struct vrequest *areq) rbuf[alen - 1] = 0; alen = strlen(rbuf) + 1; tp = afs_osi_Alloc(alen); /* make room for terminating null */ + osi_Assert(tp != NULL); memcpy(tp, rbuf, alen); osi_FreeLargeSpace(rbuf); if (code != len) { @@ -389,6 +391,7 @@ afs_UFSHandleLink(struct vcache *avc, struct vrequest *areq) rbuf[alen - 1] = '\0'; alen = strlen(rbuf) + 1; tp = afs_osi_Alloc(alen); /* make room for terminating null */ + osi_Assert(tp != NULL); memcpy(tp, rbuf, alen); osi_FreeLargeSpace(rbuf); if (code != tlen) { diff --git a/src/afs/afs_analyze.c b/src/afs/afs_analyze.c index 22b36e75a..8e7a88351 100644 --- a/src/afs/afs_analyze.c +++ b/src/afs/afs_analyze.c @@ -110,6 +110,7 @@ VLDB_Same(struct VenusFid *afid, struct vrequest *areq) if ((i = afs_InitReq(&treq, afs_osi_credp))) return DUNNO; v = afs_osi_Alloc(sizeof(*v)); + osi_Assert(v != NULL); tcell = afs_GetCell(afid->Cell, READ_LOCK); bp = afs_cv2string(&tbuf[CVBS], afid->Fid.Volume); do { diff --git a/src/afs/afs_axscache.c b/src/afs/afs_axscache.c index 790a23823..08f233aa0 100644 --- a/src/afs/afs_axscache.c +++ b/src/afs/afs_axscache.c @@ -69,6 +69,7 @@ axs_Alloc(void) return i; } else { h = afs_osi_Alloc(sizeof(struct xfreelist)); + osi_Assert(h != NULL); afs_xaxscnt++; xsp = xfreemallocs; xfreemallocs = h; diff --git a/src/afs/afs_buffer.c b/src/afs/afs_buffer.c index e65d789e6..656365691 100644 --- a/src/afs/afs_buffer.c +++ b/src/afs/afs_buffer.c @@ -119,8 +119,8 @@ DInit(int abuffers) abuffers = ((abuffers - 1) | (NPB - 1)) + 1; afs_max_buffers = abuffers << 2; /* possibly grow up to 4 times as big */ LOCK_INIT(&afs_bufferLock, "afs_bufferLock"); - Buffers = - (struct buffer *)afs_osi_Alloc(afs_max_buffers * sizeof(struct buffer)); + Buffers = afs_osi_Alloc(afs_max_buffers * sizeof(struct buffer)); + osi_Assert(Buffers != NULL); timecounter = 1; afs_stats_cmperf.bufAlloced = nbuffers = abuffers; for (i = 0; i < PHSIZE; i++) @@ -128,7 +128,8 @@ DInit(int abuffers) for (i = 0; i < abuffers; i++) { if ((i & (NPB - 1)) == 0) { /* time to allocate a fresh buffer */ - BufferData = (char *) afs_osi_Alloc(AFS_BUFFER_PAGESIZE * NPB); + BufferData = afs_osi_Alloc(AFS_BUFFER_PAGESIZE * NPB); + osi_Assert(BufferData != NULL); } /* Fill in each buffer with an empty indication. */ tb = &Buffers[i]; @@ -337,7 +338,8 @@ afs_newslot(struct dcache *adc, afs_int32 apage, struct buffer *lp) return 0; } - BufferData = (char *) afs_osi_Alloc(AFS_BUFFER_PAGESIZE * NPB); + BufferData = afs_osi_Alloc(AFS_BUFFER_PAGESIZE * NPB); + osi_Assert(BufferData != NULL); for (i = 0; i< NPB; i++) { /* Fill in each buffer with an empty indication. */ tp = &Buffers[i + nbuffers]; diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 7bade4fdf..2fd25b7cd 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -535,7 +535,9 @@ afs_syscall_call(long parm, long parm2, long parm3, sizeof(struct afs_uspc_param), code); namebufsz = mvParam->bufSz; param1 = afs_osi_Alloc(namebufsz); + osi_Assert(param1 != NULL); param2 = afs_osi_Alloc(namebufsz); + osi_Assert(param2 != NULL); while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState); @@ -734,6 +736,7 @@ afs_syscall_call(long parm, long parm2, long parm3, * home cell flag (0x1 bit) and the nosuid flag (0x2 bit) */ struct afsop_cell *tcell = afs_osi_Alloc(sizeof(struct afsop_cell)); + osi_Assert(tcell != NULL); code = afs_InitDynroot(); if (!code) { AFS_COPYIN(AFSKPTR(parm2), (caddr_t)tcell->hosts, sizeof(tcell->hosts), @@ -756,6 +759,9 @@ afs_syscall_call(long parm, long parm2, long parm3, char *tbuffer1 = osi_AllocSmallSpace(AFS_SMALLOCSIZ); int cflags = parm4; + osi_Assert(tcell != NULL); + osi_Assert(tbuffer != NULL); + osi_Assert(tbuffer1 != NULL); code = afs_InitDynroot(); if (!code) { #if 0 @@ -958,6 +964,9 @@ afs_syscall_call(long parm, long parm2, long parm3, afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR); int i; + osi_Assert(buffer != NULL); + osi_Assert(maskbuffer != NULL); + osi_Assert(mtubuffer != NULL); /* This is a refresh */ if (count & 0x40000000) { count &= ~0x40000000; @@ -1136,6 +1145,8 @@ afs_syscall_call(long parm, long parm2, long parm3, afs_int32 *kmsg = afs_osi_Alloc(kmsgLen); char *cellname = afs_osi_Alloc(cellLen); + osi_Assert(kmsg != NULL); + osi_Assert(cellname != NULL); #ifndef UKERNEL afs_osi_MaskUserLoop(); #endif diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index 0fee94acd..05d2361bd 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -909,6 +909,7 @@ SRXAFSCB_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum, */ dataBytes = sizeof(struct afs_CMStats); dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes); + osi_Assert(dataBuffP != NULL); memcpy((char *)dataBuffP, (char *)&afs_cmstats, dataBytes); a_dataP->AFSCB_CollData_len = dataBytes >> 2; a_dataP->AFSCB_CollData_val = dataBuffP; @@ -929,6 +930,7 @@ SRXAFSCB_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum, afs_CountServers(); dataBytes = sizeof(afs_stats_cmperf); dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes); + osi_Assert(dataBuffP != NULL); memcpy((char *)dataBuffP, (char *)&afs_stats_cmperf, dataBytes); a_dataP->AFSCB_CollData_len = dataBytes >> 2; a_dataP->AFSCB_CollData_val = dataBuffP; @@ -953,6 +955,7 @@ SRXAFSCB_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum, dataBytes = sizeof(afs_stats_cmfullperf); dataBuffP = (afs_int32 *) afs_osi_Alloc(dataBytes); + osi_Assert(dataBuffP != NULL); memcpy((char *)dataBuffP, (char *)(&afs_stats_cmfullperf), dataBytes); a_dataP->AFSCB_CollData_len = dataBytes >> 2; a_dataP->AFSCB_CollData_val = dataBuffP; @@ -1306,8 +1309,8 @@ SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index, p_name = tcell->cellName; for (j = 0; j < AFSMAXCELLHOSTS && tcell->cellHosts[j]; j++); i = strlen(p_name); - a_hosts->serverList_val = - (afs_int32 *) afs_osi_Alloc(j * sizeof(afs_int32)); + a_hosts->serverList_val = afs_osi_Alloc(j * sizeof(afs_int32)); + osi_Assert(a_hosts->serverList_val != NULL); a_hosts->serverList_len = j; for (j = 0; j < AFSMAXCELLHOSTS && tcell->cellHosts[j]; j++) a_hosts->serverList_val[j] = @@ -1315,7 +1318,7 @@ SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index, afs_PutCell(tcell, READ_LOCK); } - t_name = (char *)afs_osi_Alloc(i + 1); + t_name = afs_osi_Alloc(i + 1); if (t_name == NULL) { afs_osi_Free(a_hosts->serverList_val, (j * sizeof(afs_int32))); RX_AFS_GUNLOCK(); @@ -1373,7 +1376,7 @@ SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name) plen = strlen(p_name); else plen = 0; - t_name = (char *)afs_osi_Alloc(plen + 1); + t_name = afs_osi_Alloc(plen + 1); if (t_name == NULL) { if (tcell) afs_PutCell(tcell, READ_LOCK); @@ -1470,7 +1473,7 @@ SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion, * Currently only support version 1 */ allocsize = sizeof(cm_initparams_v1); - t_config = (afs_uint32 *) afs_osi_Alloc(allocsize); + t_config = afs_osi_Alloc(allocsize); if (t_config == NULL) { RX_AFS_GUNLOCK(); return ENOMEM; @@ -1611,8 +1614,8 @@ SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum, for (sn = 0; sn < AFSMAXCELLHOSTS && tcell->cellHosts[sn]; sn++); a_hosts->serverList_len = sn; - a_hosts->serverList_val = - (afs_int32 *) afs_osi_Alloc(sn * sizeof(afs_int32)); + a_hosts->serverList_val = afs_osi_Alloc(sn * sizeof(afs_int32)); + osi_Assert(a_hosts->serverList_val != NULL); for (i = 0; i < sn; i++) a_hosts->serverList_val[i] = ntohl(tcell->cellHosts[i]->addr->sa_ip); @@ -1653,7 +1656,8 @@ SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call, RX_AFS_GUNLOCK(); dataBytes = 1 * sizeof(afs_uint32); - dataBuffP = (afs_uint32 *) afs_osi_Alloc(dataBytes); + dataBuffP = afs_osi_Alloc(dataBytes); + osi_Assert(dataBuffP != NULL); dataBuffP[0] = CLIENT_CAPABILITY_ERRORTRANS; capabilities->Capabilities_len = dataBytes / sizeof(afs_uint32); capabilities->Capabilities_val = dataBuffP; diff --git a/src/afs/afs_cell.c b/src/afs/afs_cell.c index a81976742..c6f8c2f51 100644 --- a/src/afs/afs_cell.c +++ b/src/afs/afs_cell.c @@ -229,7 +229,8 @@ afs_cellname_new(char *name, afs_int32 cellnum) if (cellnum == 0) cellnum = afs_cellnum_next; - cn = (struct cell_name *)afs_osi_Alloc(sizeof(*cn)); + cn = afs_osi_Alloc(sizeof(*cn)); + osi_Assert(cn != NULL); cn->next = afs_cellname_head; cn->cellnum = cellnum; cn->cellname = afs_strdup(name); @@ -511,7 +512,8 @@ afs_NewCellAlias(char *alias, char *cell) } UpgradeSToWLock(&afs_xcell, 682); - tc = (struct cell_alias *)afs_osi_Alloc(sizeof(struct cell_alias)); + tc = afs_osi_Alloc(sizeof(struct cell_alias)); + osi_Assert(tc != NULL); tc->alias = afs_strdup(alias); tc->cell = afs_strdup(cell); tc->next = afs_cellalias_head; @@ -931,7 +933,8 @@ afs_NewCell(char *acellName, afs_int32 * acellHosts, int aflags, if (tc) { aflags &= ~CNoSUID; } else { - tc = (struct cell *)afs_osi_Alloc(sizeof(struct cell)); + tc = afs_osi_Alloc(sizeof(struct cell)); + osi_Assert(tc != NULL); memset(tc, 0, sizeof(*tc)); tc->cellName = afs_strdup(acellName); tc->fsport = AFS_FSPORT; diff --git a/src/afs/afs_conn.c b/src/afs/afs_conn.c index 919d029b8..91f56e73b 100644 --- a/src/afs/afs_conn.c +++ b/src/afs/afs_conn.c @@ -243,7 +243,8 @@ afs_ConnBySA(struct srvAddr *sap, unsigned short aport, afs_int32 acell, * gets set, marking the time of its ``birth''. */ UpgradeSToWLock(&afs_xconn, 37); - tc = (struct afs_conn *)afs_osi_Alloc(sizeof(struct afs_conn)); + tc = afs_osi_Alloc(sizeof(struct afs_conn)); + osi_Assert(tc != NULL); memset(tc, 0, sizeof(struct afs_conn)); tc->user = tu; diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 661b31ba0..7de98c124 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -2596,7 +2596,8 @@ afs_MemGetDSlot(afs_int32 aslot, struct dcache *tmpdc) if (!afs_freeDSList) { /* none free, making one is better than a panic */ afs_stats_cmperf.dcacheXAllocs++; /* count in case we have a leak */ - tdc = (struct dcache *)afs_osi_Alloc(sizeof(struct dcache)); + tdc = afs_osi_Alloc(sizeof(struct dcache)); + osi_Assert(tdc != NULL); #ifdef KERNEL_HAVE_PIN pin((char *)tdc, sizeof(struct dcache)); /* XXX */ #endif @@ -2693,7 +2694,8 @@ afs_UFSGetDSlot(afs_int32 aslot, struct dcache *tmpdc) if (!afs_freeDSList) { /* none free, making one is better than a panic */ afs_stats_cmperf.dcacheXAllocs++; /* count in case we have a leak */ - tdc = (struct dcache *)afs_osi_Alloc(sizeof(struct dcache)); + tdc = afs_osi_Alloc(sizeof(struct dcache)); + osi_Assert(tdc != NULL); #ifdef KERNEL_HAVE_PIN pin((char *)tdc, sizeof(struct dcache)); /* XXX */ #endif @@ -3066,37 +3068,41 @@ afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk, int aflags) if (aDentries > 512) afs_dhashsize = 2048; /* initialize hash tables */ - afs_dvhashTbl = - (afs_int32 *) afs_osi_Alloc(afs_dhashsize * sizeof(afs_int32)); - afs_dchashTbl = - (afs_int32 *) afs_osi_Alloc(afs_dhashsize * sizeof(afs_int32)); + afs_dvhashTbl = afs_osi_Alloc(afs_dhashsize * sizeof(afs_int32)); + osi_Assert(afs_dvhashTbl != NULL); + afs_dchashTbl = afs_osi_Alloc(afs_dhashsize * sizeof(afs_int32)); + osi_Assert(afs_dchashTbl != NULL); for (i = 0; i < afs_dhashsize; i++) { afs_dvhashTbl[i] = NULLIDX; afs_dchashTbl[i] = NULLIDX; } - afs_dvnextTbl = (afs_int32 *) afs_osi_Alloc(afiles * sizeof(afs_int32)); - afs_dcnextTbl = (afs_int32 *) afs_osi_Alloc(afiles * sizeof(afs_int32)); + afs_dvnextTbl = afs_osi_Alloc(afiles * sizeof(afs_int32)); + osi_Assert(afs_dvnextTbl != NULL); + afs_dcnextTbl = afs_osi_Alloc(afiles * sizeof(afs_int32)); + osi_Assert(afs_dcnextTbl != NULL); for (i = 0; i < afiles; i++) { afs_dvnextTbl[i] = NULLIDX; afs_dcnextTbl[i] = NULLIDX; } /* Allocate and zero the pointer array to the dcache entries */ - afs_indexTable = (struct dcache **) - afs_osi_Alloc(sizeof(struct dcache *) * afiles); + afs_indexTable = afs_osi_Alloc(sizeof(struct dcache *) * afiles); + osi_Assert(afs_indexTable != NULL); memset(afs_indexTable, 0, sizeof(struct dcache *) * afiles); - afs_indexTimes = - (afs_hyper_t *) afs_osi_Alloc(afiles * sizeof(afs_hyper_t)); + afs_indexTimes = afs_osi_Alloc(afiles * sizeof(afs_hyper_t)); + osi_Assert(afs_indexTimes != NULL); memset(afs_indexTimes, 0, afiles * sizeof(afs_hyper_t)); - afs_indexUnique = - (afs_int32 *) afs_osi_Alloc(afiles * sizeof(afs_uint32)); + afs_indexUnique = afs_osi_Alloc(afiles * sizeof(afs_uint32)); + osi_Assert(afs_indexUnique != NULL); memset(afs_indexUnique, 0, afiles * sizeof(afs_uint32)); - afs_indexFlags = (u_char *) afs_osi_Alloc(afiles * sizeof(u_char)); + afs_indexFlags = afs_osi_Alloc(afiles * sizeof(u_char)); + osi_Assert(afs_indexFlags != NULL); memset(afs_indexFlags, 0, afiles * sizeof(char)); /* Allocate and thread the struct dcache entries themselves */ tdp = afs_Initial_freeDSList = - (struct dcache *)afs_osi_Alloc(aDentries * sizeof(struct dcache)); + afs_osi_Alloc(aDentries * sizeof(struct dcache)); + osi_Assert(tdp != NULL); memset(tdp, 0, aDentries * sizeof(struct dcache)); #ifdef KERNEL_HAVE_PIN pin((char *)afs_indexTable, sizeof(struct dcache *) * afiles); /* XXX */ @@ -3350,7 +3356,7 @@ afs_MakeShadowDir(struct vcache *avc, struct dcache *adc) ReleaseWriteLock(&afs_xdcache); /* Alloc a 4k block. */ - data = (char *) afs_osi_Alloc(4096); + data = afs_osi_Alloc(4096); if (!data) { afs_warn("afs_MakeShadowDir: could not alloc data\n"); ret_code = ENOMEM; diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index 6bb41fdbb..06d4d0cc2 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -563,7 +563,7 @@ afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq) old_pdir_fid.Fid.Unique = avc->f.oldParent.unique; /* Get old name. */ - old_name = (char *) afs_osi_Alloc(AFSNAMEMAX); + old_name = afs_osi_Alloc(AFSNAMEMAX); if (!old_name) { /* printf("afs_ProcessOpRename: Couldn't alloc space for old name.\n"); */ return ENOMEM; @@ -575,7 +575,7 @@ afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq) } /* Alloc data first. */ - new_name = (char *) afs_osi_Alloc(AFSNAMEMAX); + new_name = afs_osi_Alloc(AFSNAMEMAX); if (!new_name) { /* printf("afs_ProcessOpRename: Couldn't alloc space for new name.\n"); */ code = ENOMEM; diff --git a/src/afs/afs_dynroot.c b/src/afs/afs_dynroot.c index 9a4e1ad31..6950fed4a 100644 --- a/src/afs/afs_dynroot.c +++ b/src/afs/afs_dynroot.c @@ -347,6 +347,7 @@ afs_RebuildDynroot(void) } dotLen = strlen(c->cellName) + 2; dotCell = afs_osi_Alloc(dotLen); + osi_Assert(dotCell != NULL); strcpy(dotCell, "."); afs_strcat(dotCell, c->cellName); @@ -365,6 +366,7 @@ afs_RebuildDynroot(void) dotLen = strlen(ca->alias) + 2; dotCell = afs_osi_Alloc(dotLen); + osi_Assert(dotCell != NULL); strcpy(dotCell, "."); afs_strcat(dotCell, ca->alias); @@ -385,6 +387,7 @@ afs_RebuildDynroot(void) dirSize = (curPage + 1) * AFS_PAGESIZE; newDir = afs_osi_Alloc(dirSize); + osi_Assert(newDir != NULL); /* * Now actually construct the directory. @@ -425,6 +428,7 @@ afs_RebuildDynroot(void) dotLen = strlen(c->cellName) + 2; dotCell = afs_osi_Alloc(dotLen); + osi_Assert(dotCell != NULL); strcpy(dotCell, "."); afs_strcat(dotCell, c->cellName); afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, c->cellName, @@ -444,6 +448,7 @@ afs_RebuildDynroot(void) dotLen = strlen(ca->alias) + 2; dotCell = afs_osi_Alloc(dotLen); + osi_Assert(dotCell != NULL); strcpy(dotCell, "."); afs_strcat(dotCell, ca->alias); afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ca->alias, @@ -482,6 +487,7 @@ afs_RebuildDynrootMount(void) struct DirHeader *dirHeader; newDir = afs_osi_Alloc(AFS_PAGESIZE); + osi_Assert(newDir != NULL); /* * Now actually construct the directory. @@ -650,6 +656,7 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) if (ts) { linklen = strlen(ts->target); avc->linkData = afs_osi_Alloc(linklen + 1); + osi_Assert(avc->linkData != NULL); strcpy(avc->linkData, ts->target); status->Length = linklen; @@ -695,6 +702,7 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) int namelen = strlen(realName); linklen = rw + namelen; avc->linkData = afs_osi_Alloc(linklen + 1); + osi_Assert(avc->linkData != NULL); strcpy(avc->linkData, rw ? "." : ""); afs_strcat(avc->linkData, realName); } @@ -717,6 +725,7 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) bp = afs_cv2string(&tbuf[CVBS], avc->f.fid.Fid.Unique); linklen = 2 + namelen + strlen(bp); avc->linkData = afs_osi_Alloc(linklen + 1); + osi_Assert(avc->linkData != NULL); strcpy(avc->linkData, "%"); afs_strcat(avc->linkData, c->cellName); afs_strcat(avc->linkData, ":"); @@ -740,6 +749,7 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status) namelen = strlen(c->cellName); linklen = 1 + namelen + 10; avc->linkData = afs_osi_Alloc(linklen + 1); + osi_Assert(avc->linkData != NULL); strcpy(avc->linkData, rw ? "%" : "#"); afs_strcat(avc->linkData, c->cellName); afs_strcat(avc->linkData, ":root.cell"); @@ -859,11 +869,14 @@ afs_DynrootVOPSymlink(struct vcache *avc, afs_ucred_t *acred, /* Doesn't already exist -- go ahead and create it */ tps = afs_osi_Alloc(sizeof(*tps)); + osi_Assert(tps != NULL); tps->index = afs_dynSymlinkIndex++; tps->next = afs_dynSymlinkBase; tps->name = afs_osi_Alloc(strlen(aname) + 1); + osi_Assert(tps->name != NULL); strcpy(tps->name, aname); tps->target = afs_osi_Alloc(strlen(atargetName) + 1); + osi_Assert(tps->target != NULL); strcpy(tps->target, atargetName); afs_dynSymlinkBase = tps; ReleaseWriteLock(&afs_dynSymlinkLock); diff --git a/src/afs/afs_exporter.c b/src/afs/afs_exporter.c index 4bc777a4a..891b11b49 100644 --- a/src/afs/afs_exporter.c +++ b/src/afs/afs_exporter.c @@ -35,7 +35,8 @@ exporter_add(afs_int32 size, struct exporterops *ops, afs_int32 state, LOCK_INIT(&afs_xexp, "afs_xexp"); } length = (size ? size : sizeof(struct afs_exporter)); - ex = (struct afs_exporter *)afs_osi_Alloc(length); + ex = afs_osi_Alloc(length); + osi_Assert(ex != NULL); memset(ex, 0, length); ObtainWriteLock(&afs_xexp, 308); for (op = root_exported; op; op = op->exp_next) { diff --git a/src/afs/afs_icl.c b/src/afs/afs_icl.c index c8547efad..7a2ec9843 100644 --- a/src/afs/afs_icl.c +++ b/src/afs/afs_icl.c @@ -932,8 +932,8 @@ afs_icl_LogUse(struct afs_icl_log *logp) /* we weren't passed in a hint and it wasn't set */ logp->logSize = ICL_DEFAULT_LOGSIZE; } - logp->datap = - (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logp->logSize); + logp->datap = afs_osi_Alloc(sizeof(afs_int32) * logp->logSize); + osi_Assert(logp->datap != NULL); #ifdef KERNEL_HAVE_PIN pin((char *)logp->datap, sizeof(afs_int32) * logp->logSize); #endif @@ -980,8 +980,8 @@ afs_icl_LogSetSize(struct afs_icl_log *logp, afs_int32 logSize) #ifdef KERNEL_HAVE_PIN unpin((char *)logp->datap, sizeof(afs_int32) * logp->logSize); #endif - logp->datap = - (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logSize); + logp->datap = afs_osi_Alloc(sizeof(afs_int32) * logSize); + osi_Assert(logp->datap != NULL); #ifdef KERNEL_HAVE_PIN pin((char *)logp->datap, sizeof(afs_int32) * logSize); #endif @@ -1171,6 +1171,7 @@ afs_icl_CreateSetWithFlags(char *name, struct afs_icl_log *baseLogp, strcpy(setp->name, name); setp->nevents = ICL_DEFAULTEVENTS; setp->eventFlags = afs_osi_Alloc(ICL_DEFAULTEVENTS); + osi_Assert(setp->eventFlags != NULL); #ifdef KERNEL_HAVE_PIN pin((char *)setp->eventFlags, ICL_DEFAULTEVENTS); #endif diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index 1ad7725e2..a194cdb7b 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -143,7 +143,8 @@ afs_CacheInit(afs_int32 astatSize, afs_int32 afiles, afs_int32 ablocks, else if (aVolumes > 32767) aVolumes = 32767; - tv = (struct volume *)afs_osi_Alloc(aVolumes * sizeof(struct volume)); + tv = afs_osi_Alloc(aVolumes * sizeof(struct volume)); + osi_Assert(tv != NULL); for (i = 0; i < aVolumes - 1; i++) tv[i].next = &tv[i + 1]; tv[aVolumes - 1].next = NULL; @@ -535,8 +536,10 @@ afs_ResourceInit(int preallocs) afs_resourceinit_flag = 1; for (i = 0; i < NFENTRIES; i++) fvTable[i] = 0; - for (i = 0; i < MAXNUMSYSNAMES; i++) + for (i = 0; i < MAXNUMSYSNAMES; i++) { afs_sysnamelist[i] = afs_osi_Alloc(MAXSYSNAME); + osi_Assert(afs_sysnamelist[i] != NULL); + } afs_sysname = afs_sysnamelist[0]; strcpy(afs_sysname, SYS_NAME); afs_sysnamecount = 1; diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index 51b7561f7..e2613db03 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -35,8 +35,9 @@ afs_InitMemCache(int blkCount, int blkSize, int flags) memCacheBlkSize = blkSize; memMaxBlkNumber = blkCount; - memCache = (struct memCacheEntry *) + memCache = afs_osi_Alloc(memMaxBlkNumber * sizeof(struct memCacheEntry)); + osi_Assert(memCache != NULL); for (index = 0; index < memMaxBlkNumber; index++) { char *blk; diff --git a/src/afs/afs_nfsclnt.c b/src/afs/afs_nfsclnt.c index e13f2c7e5..cc72f7b5f 100644 --- a/src/afs/afs_nfsclnt.c +++ b/src/afs/afs_nfsclnt.c @@ -76,7 +76,8 @@ afs_GetNfsClientPag(afs_int32 uid, afs_uint32 host) return np; } } - np = (struct nfsclientpag *)afs_osi_Alloc(sizeof(struct nfsclientpag)); + np = afs_osi_Alloc(sizeof(struct nfsclientpag)); + osi_Assert(np != NULL); memset(np, 0, sizeof(struct nfsclientpag)); /* Copy the necessary afs_exporter fields */ memcpy((char *)np, (char *)afs_nfsexporter, sizeof(struct afs_exporter)); @@ -483,6 +484,7 @@ afs_nfsclient_sysname(struct nfsclientpag *np, char *inname, } for(count=0; count < *num;++count) { np->sysname[count]= afs_osi_Alloc(MAXSYSNAME); + osi_Assert(np->sysname[count] != NULL); } cp = inname; for(count=0; count < *num;++count) { diff --git a/src/afs/afs_osi_alloc.c b/src/afs/afs_osi_alloc.c index 8ee50ae73..d2d9b3469 100644 --- a/src/afs/afs_osi_alloc.c +++ b/src/afs/afs_osi_alloc.c @@ -138,7 +138,7 @@ osi_AllocLargeSpace(size_t size) char *p; afs_stats_cmperf.LargeBlocksAlloced++; - p = (char *)afs_osi_Alloc(AFS_LRALLOCSIZ); + p = afs_osi_Alloc(AFS_LRALLOCSIZ); #ifdef KERNEL_HAVE_PIN /* * Need to pin this memory since under heavy conditions this memory diff --git a/src/afs/afs_pag_call.c b/src/afs/afs_pag_call.c index 7ca57dcbc..5c61015a4 100644 --- a/src/afs/afs_pag_call.c +++ b/src/afs/afs_pag_call.c @@ -111,8 +111,10 @@ afspag_Init(afs_int32 nfs_server_addr) afs_resourceinit_flag = 1; afs_nfs_server_addr = nfs_server_addr; - for (i = 0; i < MAXNUMSYSNAMES; i++) + for (i = 0; i < MAXNUMSYSNAMES; i++) { afs_sysnamelist[i] = afs_osi_Alloc(MAXSYSNAME); + osi_Assert(afs_sysnamelist[i] != NULL); + } afs_sysname = afs_sysnamelist[0]; strcpy(afs_sysname, SYS_NAME); afs_sysnamecount = 1; diff --git a/src/afs/afs_pag_cred.c b/src/afs/afs_pag_cred.c index 3a0c2c52e..bbe042592 100644 --- a/src/afs/afs_pag_cred.c +++ b/src/afs/afs_pag_cred.c @@ -45,10 +45,10 @@ afspag_GetCell(char *acell) } if (!tcell) { - tcell = (struct afspag_cell *)afs_osi_Alloc(sizeof(struct afspag_cell)); + tcell = afs_osi_Alloc(sizeof(struct afspag_cell)); if (!tcell) goto out; - tcell->cellname = (char *)afs_osi_Alloc(strlen(acell) + 1); + tcell->cellname = afs_osi_Alloc(strlen(acell) + 1); if (!tcell->cellname) { afs_osi_Free(tcell, sizeof(struct afspag_cell)); tcell = 0; @@ -244,8 +244,7 @@ SPAGCB_GetCreds(struct rx_call *a_call, afs_int32 a_uid, return UAESRCH; } - a_creds->CredInfos_val = - (CredInfo *)afs_osi_Alloc(count * sizeof(CredInfo)); + a_creds->CredInfos_val = afs_osi_Alloc(count * sizeof(CredInfo)); if (!a_creds->CredInfos_val) goto out; a_creds->CredInfos_len = count; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index f89998b96..b18b45a46 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -1957,6 +1957,8 @@ DECL_PIOCTL(PGetVolumeStatus) char *Name; XSTATS_DECLS; + osi_Assert(offLineMsg != NULL); + osi_Assert(motd != NULL); AFS_STATCNT(PGetVolumeStatus); if (!avc) { code = EINVAL; @@ -3864,7 +3866,8 @@ ReSortCells(int s, afs_int32 * l, int vlonly) if (vlonly) { afs_int32 *p; - p = (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * (s + 1)); + p = afs_osi_Alloc(sizeof(afs_int32) * (s + 1)); + osi_Assert(p != NULL); p[0] = s; memcpy(p + 1, l, s * sizeof(afs_int32)); afs_TraverseCells(&ReSortCells_cb, p); @@ -5120,6 +5123,7 @@ DECL_PIOCTL(PCallBackAddr) } addrs = afs_osi_Alloc(srvAddrCount * sizeof(*addrs)); + osi_Assert(addrs != NULL); j = 0; for (i = 0; i < NSERVERS; i++) { for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) { diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index 911504c22..7dc9d98a0 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -592,7 +592,7 @@ afs_ExtendSegments(struct vcache *avc, afs_size_t alen, struct vrequest *areq) struct dcache *tdc; void *zeros; - zeros = (void *) afs_osi_Alloc(AFS_PAGESIZE); + zeros = afs_osi_Alloc(AFS_PAGESIZE); if (zeros == NULL) return ENOMEM; memset(zeros, 0, AFS_PAGESIZE); diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index cf3db576f..66546dfd0 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -505,6 +505,7 @@ ForceAllNewConnections(void) } addrs = afs_osi_Alloc(srvAddrCount * sizeof(*addrs)); + osi_Assert(addrs != NULL); j = 0; for (i = 0; i < NSERVERS; i++) { for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) { @@ -571,6 +572,7 @@ afs_CheckServers(int adown, struct cell *acellp) } addrs = afs_osi_Alloc(srvAddrCount * sizeof(*addrs)); + osi_Assert(addrs != NULL); j = 0; for (i = 0; i < NSERVERS; i++) { for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) { @@ -583,13 +585,19 @@ afs_CheckServers(int adown, struct cell *acellp) ReleaseReadLock(&afs_xsrvAddr); ReleaseReadLock(&afs_xserver); - conns = (struct afs_conn **)afs_osi_Alloc(j * sizeof(struct afs_conn *)); - rxconns = (struct rx_connection **)afs_osi_Alloc(j * sizeof(struct rx_connection *)); - conntimer = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32)); - deltas = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32)); - results = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32)); - - caps = (Capabilities *)afs_osi_Alloc(j * sizeof (Capabilities)); + conns = afs_osi_Alloc(j * sizeof(struct afs_conn *)); + osi_Assert(conns != NULL); + rxconns = afs_osi_Alloc(j * sizeof(struct rx_connection *)); + osi_Assert(rxconns != NULL); + conntimer = afs_osi_Alloc(j * sizeof (afs_int32)); + osi_Assert(conntimer != NULL); + deltas = afs_osi_Alloc(j * sizeof (afs_int32)); + osi_Assert(deltas != NULL); + results = afs_osi_Alloc(j * sizeof (afs_int32)); + osi_Assert(results != NULL); + + caps = afs_osi_Alloc(j * sizeof (Capabilities)); + osi_Assert(caps != NULL); memset(caps, 0, j * sizeof(Capabilities)); for (i = 0; i < j; i++) { @@ -1792,7 +1800,7 @@ afs_GetServer(afs_uint32 * aserverp, afs_int32 nservers, afs_int32 acell, if (oldts) { newts = oldts; } else { - newts = (struct server *)afs_osi_Alloc(sizeof(struct server)); + newts = afs_osi_Alloc(sizeof(struct server)); if (!newts) panic("malloc of server struct"); afs_totalServers++; @@ -1837,7 +1845,7 @@ afs_GetServer(afs_uint32 * aserverp, afs_int32 nservers, afs_int32 acell, if (oldsa) { newsa = oldsa; } else { - newsa = (struct srvAddr *)afs_osi_Alloc(sizeof(struct srvAddr)); + newsa = afs_osi_Alloc(sizeof(struct srvAddr)); if (!newsa) panic("malloc of srvAddr struct"); afs_totalSrvAddrs++; @@ -1887,8 +1895,7 @@ afs_GetServer(afs_uint32 * aserverp, afs_int32 nservers, afs_int32 acell, /* Have a srvAddr struct. Now get a server struct (if not already) */ if (!orphts) { - orphts = - (struct server *)afs_osi_Alloc(sizeof(struct server)); + orphts = afs_osi_Alloc(sizeof(struct server)); if (!orphts) panic("malloc of lo server struct"); memset(orphts, 0, sizeof(struct server)); diff --git a/src/afs/afs_tokens.c b/src/afs/afs_tokens.c index 8bc502030..1b8879035 100644 --- a/src/afs/afs_tokens.c +++ b/src/afs/afs_tokens.c @@ -134,6 +134,7 @@ afs_AddToken(struct tokenJar **tokens, rx_securityIndex type) { struct tokenJar *newToken; newToken = afs_osi_Alloc(sizeof(struct tokenJar)); + osi_Assert(newToken != NULL); memset(newToken, 0, sizeof(*newToken)); newToken->type = type; @@ -316,6 +317,7 @@ afs_AddRxkadToken(struct tokenJar **tokens, char *ticket, int ticketLen, rxkad = &tokenU->rxkad; rxkad->ticket = afs_osi_Alloc(ticketLen); + osi_Assert(rxkad->ticket != NULL); rxkad->ticketLen = ticketLen; memcpy(rxkad->ticket, ticket, ticketLen); rxkad->clearToken = *clearToken; diff --git a/src/afs/afs_user.c b/src/afs/afs_user.c index f53ef928c..d22f2abe7 100644 --- a/src/afs/afs_user.c +++ b/src/afs/afs_user.c @@ -467,7 +467,8 @@ afs_GetUser(afs_int32 auid, afs_int32 acell, afs_int32 locktype) } } } - tu = (struct unixuser *)afs_osi_Alloc(sizeof(struct unixuser)); + tu = afs_osi_Alloc(sizeof(struct unixuser)); + osi_Assert(tu != NULL); #ifndef AFS_NOSTATS afs_stats_cmfullperf.authent.PAGCreations++; #endif /* AFS_NOSTATS */ diff --git a/src/afs/afs_util.c b/src/afs/afs_util.c index 2b20a94ba..09646bd1d 100644 --- a/src/afs/afs_util.c +++ b/src/afs/afs_util.c @@ -187,7 +187,7 @@ afs_strdup(char *s) int cc; cc = strlen(s) + 1; - n = (char *)afs_osi_Alloc(cc); + n = afs_osi_Alloc(cc); if (n) memcpy(n, s, cc); diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index d19a68d70..130868e26 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -311,9 +311,8 @@ afs_AllocCBR(void) afs_stats_cmperf.CallBackFlushes++; } else { /* try allocating */ - tsp = - (struct afs_cbr *)afs_osi_Alloc(AFS_NCBRS * - sizeof(struct afs_cbr)); + tsp = afs_osi_Alloc(AFS_NCBRS * sizeof(struct afs_cbr)); + osi_Assert(tsp != NULL); for (i = 0; i < AFS_NCBRS - 1; i++) { tsp[i].next = &tsp[i + 1]; tsp[i].dynalloc = 0; @@ -388,6 +387,7 @@ afs_FlushVCBs(afs_int32 lockit) return code; treq.flags |= O_NONBLOCK; tfids = afs_osi_Alloc(sizeof(struct AFSFid) * AFS_MAXCBRSCALL); + osi_Assert(tfids != NULL); if (lockit) ObtainWriteLock(&afs_xvcb, 273); @@ -2872,7 +2872,8 @@ afs_vcacheInit(int astatSize) #if !defined(AFS_LINUX22_ENV) /* Allocate and thread the struct vcache entries */ - tvp = (struct vcache *)afs_osi_Alloc(astatSize * sizeof(struct vcache)); + tvp = afs_osi_Alloc(astatSize * sizeof(struct vcache)); + osi_Assert(tvp != NULL); memset(tvp, 0, sizeof(struct vcache) * astatSize); Initial_freeVCList = tvp; diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 248d48c74..d0d5c3b5c 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -245,7 +245,8 @@ afs_MemGetVolSlot(void) if (!afs_freeVolList) { struct volume *newVp; - newVp = (struct volume *)afs_osi_Alloc(sizeof(struct volume)); + newVp = afs_osi_Alloc(sizeof(struct volume)); + osi_Assert(newVp != NULL); newVp->next = NULL; afs_freeVolList = newVp; @@ -312,7 +313,7 @@ afs_CheckVolumeNames(int flags) for (tv = afs_volumes[i]; tv; tv = tv->next) ++vsize; - volumeID = (afs_int32 *) afs_osi_Alloc(2 * vsize * sizeof(*volumeID)); + volumeID = afs_osi_Alloc(2 * vsize * sizeof(*volumeID)); cellID = (volumeID) ? volumeID + vsize : 0; } @@ -631,6 +632,7 @@ afs_SetupVolume(afs_int32 volid, char *aname, void *ve, struct cell *tcell, if (agood) { if (!tv->name) { tv->name = afs_osi_Alloc(strlen(aname) + 1); + osi_Assert(tv->name != NULL); strcpy(tv->name, aname); } } @@ -698,6 +700,7 @@ afs_NewDynrootVolume(struct VenusFid *fid) if (!tcell) return NULL; tve = afs_osi_Alloc(sizeof(*tve)); + osi_Assert(tve != NULL); if (!(tcell->states & CHasVolRef)) tcell->states |= CHasVolRef; -- 2.39.5