Lines Matching full:length
130 ssize_t length; in sel_read_enforce() local
132 length = scnprintf(tmpbuf, TMPBUFLEN, "%d", in sel_read_enforce()
134 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); in sel_read_enforce()
145 ssize_t length; in sel_write_enforce() local
159 length = -EINVAL; in sel_write_enforce()
167 length = avc_has_perm(&selinux_state, in sel_write_enforce()
171 if (length) in sel_write_enforce()
189 length = count; in sel_write_enforce()
192 return length; in sel_write_enforce()
210 ssize_t length; in sel_read_handle_unknown() local
216 length = scnprintf(tmpbuf, TMPBUFLEN, "%d", handle_unknown); in sel_read_handle_unknown()
217 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); in sel_read_handle_unknown()
286 ssize_t length; in sel_write_disable() local
310 length = -EINVAL; in sel_write_disable()
316 length = selinux_disable(fsi->state); in sel_write_disable()
317 if (length) in sel_write_disable()
327 length = count; in sel_write_disable()
330 return length; in sel_write_disable()
345 ssize_t length; in sel_read_policyvers() local
347 length = scnprintf(tmpbuf, TMPBUFLEN, "%u", POLICYDB_VERSION_MAX); in sel_read_policyvers()
348 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); in sel_read_policyvers()
380 ssize_t length; in sel_read_mls() local
382 length = scnprintf(tmpbuf, TMPBUFLEN, "%d", in sel_read_mls()
384 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); in sel_read_mls()
621 ssize_t length; in sel_write_load() local
626 length = avc_has_perm(&selinux_state, in sel_write_load()
629 if (length) in sel_write_load()
633 length = -EINVAL; in sel_write_load()
637 length = -ENOMEM; in sel_write_load()
642 length = -EFAULT; in sel_write_load()
646 length = security_load_policy(fsi->state, data, count, &load_state); in sel_write_load()
647 if (length) { in sel_write_load()
652 length = sel_make_policy_nodes(fsi, load_state.policy); in sel_write_load()
653 if (length) { in sel_write_load()
661 length = count; in sel_write_load()
670 return length; in sel_write_load()
684 ssize_t length; in sel_write_context() local
686 length = avc_has_perm(&selinux_state, in sel_write_context()
689 if (length) in sel_write_context()
692 length = security_context_to_sid(state, buf, size, &sid, GFP_KERNEL); in sel_write_context()
693 if (length) in sel_write_context()
696 length = security_sid_to_context(state, sid, &canon, &len); in sel_write_context()
697 if (length) in sel_write_context()
700 length = -ERANGE; in sel_write_context()
708 length = len; in sel_write_context()
711 return length; in sel_write_context()
719 ssize_t length; in sel_read_checkreqprot() local
721 length = scnprintf(tmpbuf, TMPBUFLEN, "%u", in sel_read_checkreqprot()
723 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); in sel_read_checkreqprot()
731 ssize_t length; in sel_write_checkreqprot() local
734 length = avc_has_perm(&selinux_state, in sel_write_checkreqprot()
738 if (length) in sel_write_checkreqprot()
739 return length; in sel_write_checkreqprot()
752 length = -EINVAL; in sel_write_checkreqprot()
767 length = count; in sel_write_checkreqprot()
773 return length; in sel_write_checkreqprot()
909 * and the length returned. Otherwise return 0 or and -error.
920 ssize_t length; in sel_write_access() local
922 length = avc_has_perm(&selinux_state, in sel_write_access()
925 if (length) in sel_write_access()
928 length = -ENOMEM; in sel_write_access()
933 length = -ENOMEM; in sel_write_access()
938 length = -EINVAL; in sel_write_access()
942 length = security_context_str_to_sid(state, scon, &ssid, GFP_KERNEL); in sel_write_access()
943 if (length) in sel_write_access()
946 length = security_context_str_to_sid(state, tcon, &tsid, GFP_KERNEL); in sel_write_access()
947 if (length) in sel_write_access()
952 length = scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, in sel_write_access()
960 return length; in sel_write_access()
971 ssize_t length; in sel_write_create() local
976 length = avc_has_perm(&selinux_state, in sel_write_create()
980 if (length) in sel_write_create()
983 length = -ENOMEM; in sel_write_create()
988 length = -ENOMEM; in sel_write_create()
993 length = -ENOMEM; in sel_write_create()
998 length = -EINVAL; in sel_write_create()
1033 length = security_context_str_to_sid(state, scon, &ssid, GFP_KERNEL); in sel_write_create()
1034 if (length) in sel_write_create()
1037 length = security_context_str_to_sid(state, tcon, &tsid, GFP_KERNEL); in sel_write_create()
1038 if (length) in sel_write_create()
1041 length = security_transition_sid_user(state, ssid, tsid, tclass, in sel_write_create()
1043 if (length) in sel_write_create()
1046 length = security_sid_to_context(state, newsid, &newcon, &len); in sel_write_create()
1047 if (length) in sel_write_create()
1050 length = -ERANGE; in sel_write_create()
1058 length = len; in sel_write_create()
1064 return length; in sel_write_create()
1074 ssize_t length; in sel_write_relabel() local
1078 length = avc_has_perm(&selinux_state, in sel_write_relabel()
1082 if (length) in sel_write_relabel()
1085 length = -ENOMEM; in sel_write_relabel()
1090 length = -ENOMEM; in sel_write_relabel()
1095 length = -EINVAL; in sel_write_relabel()
1099 length = security_context_str_to_sid(state, scon, &ssid, GFP_KERNEL); in sel_write_relabel()
1100 if (length) in sel_write_relabel()
1103 length = security_context_str_to_sid(state, tcon, &tsid, GFP_KERNEL); in sel_write_relabel()
1104 if (length) in sel_write_relabel()
1107 length = security_change_sid(state, ssid, tsid, tclass, &newsid); in sel_write_relabel()
1108 if (length) in sel_write_relabel()
1111 length = security_sid_to_context(state, newsid, &newcon, &len); in sel_write_relabel()
1112 if (length) in sel_write_relabel()
1115 length = -ERANGE; in sel_write_relabel()
1120 length = len; in sel_write_relabel()
1125 return length; in sel_write_relabel()
1134 ssize_t length; in sel_write_user() local
1139 length = avc_has_perm(&selinux_state, in sel_write_user()
1143 if (length) in sel_write_user()
1146 length = -ENOMEM; in sel_write_user()
1151 length = -ENOMEM; in sel_write_user()
1156 length = -EINVAL; in sel_write_user()
1160 length = security_context_str_to_sid(state, con, &sid, GFP_KERNEL); in sel_write_user()
1161 if (length) in sel_write_user()
1164 length = security_get_user_sids(state, sid, user, &sids, &nsids); in sel_write_user()
1165 if (length) in sel_write_user()
1168 length = sprintf(buf, "%u", nsids) + 1; in sel_write_user()
1169 ptr = buf + length; in sel_write_user()
1173 length = rc; in sel_write_user()
1176 if ((length + len) >= SIMPLE_TRANSACTION_LIMIT) { in sel_write_user()
1178 length = -ERANGE; in sel_write_user()
1184 length += len; in sel_write_user()
1190 return length; in sel_write_user()
1200 ssize_t length; in sel_write_member() local
1204 length = avc_has_perm(&selinux_state, in sel_write_member()
1208 if (length) in sel_write_member()
1211 length = -ENOMEM; in sel_write_member()
1216 length = -ENOMEM; in sel_write_member()
1221 length = -EINVAL; in sel_write_member()
1225 length = security_context_str_to_sid(state, scon, &ssid, GFP_KERNEL); in sel_write_member()
1226 if (length) in sel_write_member()
1229 length = security_context_str_to_sid(state, tcon, &tsid, GFP_KERNEL); in sel_write_member()
1230 if (length) in sel_write_member()
1233 length = security_member_sid(state, ssid, tsid, tclass, &newsid); in sel_write_member()
1234 if (length) in sel_write_member()
1237 length = security_sid_to_context(state, newsid, &newcon, &len); in sel_write_member()
1238 if (length) in sel_write_member()
1241 length = -ERANGE; in sel_write_member()
1249 length = len; in sel_write_member()
1254 return length; in sel_write_member()
1273 ssize_t length; in sel_read_bool() local
1296 length = scnprintf(page, PAGE_SIZE, "%d %d", cur_enforcing, in sel_read_bool()
1299 ret = simple_read_from_buffer(buf, count, ppos, page, length); in sel_read_bool()
1314 ssize_t length; in sel_write_bool() local
1332 length = avc_has_perm(&selinux_state, in sel_write_bool()
1336 if (length) in sel_write_bool()
1339 length = -EINVAL; in sel_write_bool()
1344 length = -EINVAL; in sel_write_bool()
1352 length = count; in sel_write_bool()
1357 return length; in sel_write_bool()
1372 ssize_t length; in sel_commit_bools_write() local
1388 length = avc_has_perm(&selinux_state, in sel_commit_bools_write()
1392 if (length) in sel_commit_bools_write()
1395 length = -EINVAL; in sel_commit_bools_write()
1399 length = 0; in sel_commit_bools_write()
1401 length = security_set_bools(fsi->state, fsi->bool_num, in sel_commit_bools_write()
1404 if (!length) in sel_commit_bools_write()
1405 length = count; in sel_commit_bools_write()
1410 return length; in sel_commit_bools_write()
1509 ssize_t length; in sel_read_avc_cache_threshold() local
1511 length = scnprintf(tmpbuf, TMPBUFLEN, "%u", in sel_read_avc_cache_threshold()
1513 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); in sel_read_avc_cache_threshold()
1563 ssize_t length; in sel_read_avc_hash_stats() local
1569 length = avc_get_hash_stats(state->avc, page); in sel_read_avc_hash_stats()
1570 if (length >= 0) in sel_read_avc_hash_stats()
1571 length = simple_read_from_buffer(buf, count, ppos, page, length); in sel_read_avc_hash_stats()
1574 return length; in sel_read_avc_hash_stats()
1583 ssize_t length; in sel_read_sidtab_hash_stats() local
1589 length = security_sidtab_hash_stats(state, page); in sel_read_sidtab_hash_stats()
1590 if (length >= 0) in sel_read_sidtab_hash_stats()
1591 length = simple_read_from_buffer(buf, count, ppos, page, in sel_read_sidtab_hash_stats()
1592 length); in sel_read_sidtab_hash_stats()
1595 return length; in sel_read_sidtab_hash_stats()
1858 ssize_t length; in sel_read_policycap() local
1862 length = scnprintf(tmpbuf, TMPBUFLEN, "%d", value); in sel_read_policycap()
1864 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); in sel_read_policycap()