cifs_kcalloc(length + 2, GFP_KERNEL); 
kcalloc(1, length + 2, GFP_KERNEL); 
CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,	 const char *tree, struct cifsTconInfo *tcon,	 const struct nls_table *nls_codepage){	struct smb_hdr *smb_buffer;	struct smb_hdr *smb_buffer_response;	TCONX_REQ *pSMB;	TCONX_RSP *pSMBr;	unsigned char *bcc_ptr;	int rc = 0;	int length;	__u16 count;	if (ses == NULL)		return -EIO;	smb_buffer = cifs_buf_get();	if (smb_buffer == NULL) {		return -ENOMEM;	}	smb_buffer_response = smb_buffer;	header_assemble(smb_buffer, SMB_COM_TREE_CONNECT_ANDX,			NULL /*no tid */ , 4 /*wct */ );	smb_buffer->Uid = ses->Suid;	pSMB = (TCONX_REQ *) smb_buffer;	pSMBr = (TCONX_RSP *) smb_buffer_response;	pSMB->AndXCommand = 0xFF;	pSMB->Flags = cpu_to_le16(TCON_EXTENDED_SECINFO);	pSMB->PasswordLength = cpu_to_le16(1);	/* minimum */	bcc_ptr = &pSMB->Password[0];	bcc_ptr++;		/* skip password */	if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))		smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;	if (ses->capabilities & CAP_STATUS32) {		smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS;	}	if (ses->capabilities & CAP_DFS) {		smb_buffer->Flags2 |= SMBFLG2_DFS;	}	if (ses->capabilities & CAP_UNICODE) {		smb_buffer->Flags2 |= SMBFLG2_UNICODE;		length =		    cifs_strtoUCS((wchar_t *) bcc_ptr, tree, 100, nls_codepage);		bcc_ptr += 2 * length;	/* convert num of 16 bit words to bytes */		bcc_ptr += 2;	/* skip trailing null */	} else {		/* ASCII */		strcpy(bcc_ptr, tree);		bcc_ptr += strlen(tree) + 1;	}	strcpy(bcc_ptr, "?????");	bcc_ptr += strlen("?????");	bcc_ptr += 1;	count = bcc_ptr - &pSMB->Password[0];	pSMB->hdr.smb_buf_length += count;	pSMB->ByteCount = cpu_to_le16(count);	rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 0);	/* if (rc) rc = map_smb_to_linux_error(smb_buffer_response); */	/* above now done in SendReceive */	if ((rc == 0) && (tcon != NULL)) {		tcon->tidStatus = CifsGood;		tcon->tid = smb_buffer_response->Tid;		bcc_ptr = pByteArea(smb_buffer_response);		length = strnlen(bcc_ptr, BCC(smb_buffer_response) - 2);        /* skip service field (NB: this field is always ASCII) */		bcc_ptr += length + 1;			strncpy(tcon->treeName, tree, MAX_TREE_SIZE);		if (smb_buffer->Flags2 & SMBFLG2_UNICODE) {			length = UniStrnlen((wchar_t *) bcc_ptr, 512);			if ((bcc_ptr + (2 * length)) -			     pByteArea(smb_buffer_response) <=			    BCC(smb_buffer_response)) {				if(tcon->nativeFileSystem)					kfree(tcon->nativeFileSystem);				tcon->nativeFileSystem =				    cifs_kcalloc(length + 2, GFP_KERNEL);				cifs_strfromUCS_le(tcon->nativeFileSystem,						   (wchar_t *) bcc_ptr,						   length, nls_codepage);				bcc_ptr += 2 * length;				bcc_ptr[0] = 0;	/* null terminate the string */				bcc_ptr[1] = 0;				bcc_ptr += 2;			}			/* else do not bother copying these informational fields */		} else {			length = strnlen(bcc_ptr, 1024);			if ((bcc_ptr + length) -			    pByteArea(smb_buffer_response) <=			    BCC(smb_buffer_response)) {				if(tcon->nativeFileSystem)					kfree(tcon->nativeFileSystem);				tcon->nativeFileSystem =				    cifs_kcalloc(length + 1, GFP_KERNEL);				strncpy(tcon->nativeFileSystem, bcc_ptr,					length);			}			/* else do not bother copying these informational fields */		}		tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);		cFYI(1, ("Tcon flags: 0x%x ", tcon->Flags));	} else if ((rc == 0) && tcon == NULL) {        /* all we need to save for IPC$ connection */		ses->ipc_tid = smb_buffer_response->Tid;	}	if (smb_buffer)		cifs_buf_release(smb_buffer);	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/433dc24f24b409fb130f638aa85470a0eb666206/connect.c/clean/fs/cifs/connect.c