mysids2 = kmalloc(maxnel*sizeof(*mysids2), GFP_ATOMIC); 
mysids2 = kcalloc(maxnel, sizeof(*mysids2), GFP_ATOMIC); 
int security_get_user_sids(u32 fromsid,	                   char *username,			   u32 **sids,			   u32 *nel){	struct context *fromcon, usercon;	u32 *mysids, *mysids2, sid;	u32 mynel = 0, maxnel = SIDS_NEL;	struct user_datum *user;	struct role_datum *role;	struct av_decision avd;	struct ebitmap_node *rnode, *tnode;	int rc = 0, i, j;	if (!ss_initialized) {		*sids = NULL;		*nel = 0;		goto out;	}	POLICY_RDLOCK;	fromcon = sidtab_search(&sidtab, fromsid);	if (!fromcon) {		rc = -EINVAL;		goto out_unlock;	}	user = hashtab_search(policydb.p_users.table, username);	if (!user) {		rc = -EINVAL;		goto out_unlock;	}	usercon.user = user->value;	mysids = kmalloc(maxnel*sizeof(*mysids), GFP_ATOMIC);	if (!mysids) {		rc = -ENOMEM;		goto out_unlock;	}	memset(mysids, 0, maxnel*sizeof(*mysids));	ebitmap_for_each_bit(&user->roles, rnode, i) {		if (!ebitmap_node_get_bit(rnode, i))			continue;		role = policydb.role_val_to_struct[i];		usercon.role = i+1;		ebitmap_for_each_bit(&role->types, tnode, j) {			if (!ebitmap_node_get_bit(tnode, j))				continue;			usercon.type = j+1;			if (mls_setup_user_range(fromcon, user, &usercon))				continue;			rc = context_struct_compute_av(fromcon, &usercon,						       SECCLASS_PROCESS,						       PROCESS__TRANSITION,						       &avd);			if (rc ||  !(avd.allowed & PROCESS__TRANSITION))				continue;			rc = sidtab_context_to_sid(&sidtab, &usercon, &sid);			if (rc) {				kfree(mysids);				goto out_unlock;			}			if (mynel < maxnel) {				mysids[mynel++] = sid;			} else {				maxnel += SIDS_NEL;				mysids2 = kmalloc(maxnel*sizeof(*mysids2), GFP_ATOMIC);				if (!mysids2) {					rc = -ENOMEM;					kfree(mysids);					goto out_unlock;				}				memset(mysids2, 0, maxnel*sizeof(*mysids2));				memcpy(mysids2, mysids, mynel * sizeof(*mysids2));				kfree(mysids);				mysids = mysids2;				mysids[mynel++] = sid;			}		}	}	*sids = mysids;	*nel = mynel;out_unlock:	POLICY_RDUNLOCK;out:	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/89d155ef62e5e0c10e4b37aaa5056f0beafe10e6/services.c/buggy/security/selinux/ss/services.c