.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2003,2004 Aurelien Alleaume <slts@free.fr> |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License as published by |
---|
6 | | - * the Free Software Foundation; either version 2 of the License |
---|
7 | | - * |
---|
8 | | - * This program is distributed in the hope that it will be useful, |
---|
9 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
11 | | - * GNU General Public License for more details. |
---|
12 | | - * |
---|
13 | | - * You should have received a copy of the GNU General Public License |
---|
14 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
---|
15 | | - * |
---|
16 | 4 | */ |
---|
17 | 5 | |
---|
18 | 6 | #include <linux/kernel.h> |
---|
.. | .. |
---|
792 | 780 | { |
---|
793 | 781 | switch (isl_oid[n].flags & OID_FLAG_TYPE) { |
---|
794 | 782 | case OID_TYPE_U32: |
---|
795 | | - return snprintf(str, PRIV_STR_SIZE, "%u\n", r->u); |
---|
| 783 | + return scnprintf(str, PRIV_STR_SIZE, "%u\n", r->u); |
---|
796 | 784 | case OID_TYPE_BUFFER:{ |
---|
797 | 785 | struct obj_buffer *buff = r->ptr; |
---|
798 | | - return snprintf(str, PRIV_STR_SIZE, |
---|
| 786 | + return scnprintf(str, PRIV_STR_SIZE, |
---|
799 | 787 | "size=%u\naddr=0x%X\n", buff->size, |
---|
800 | 788 | buff->addr); |
---|
801 | 789 | } |
---|
802 | 790 | break; |
---|
803 | 791 | case OID_TYPE_BSS:{ |
---|
804 | 792 | struct obj_bss *bss = r->ptr; |
---|
805 | | - return snprintf(str, PRIV_STR_SIZE, |
---|
| 793 | + return scnprintf(str, PRIV_STR_SIZE, |
---|
806 | 794 | "age=%u\nchannel=%u\n" |
---|
807 | 795 | "capinfo=0x%X\nrates=0x%X\n" |
---|
808 | 796 | "basic_rates=0x%X\n", bss->age, |
---|
.. | .. |
---|
813 | 801 | case OID_TYPE_BSSLIST:{ |
---|
814 | 802 | struct obj_bsslist *list = r->ptr; |
---|
815 | 803 | int i, k; |
---|
816 | | - k = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr); |
---|
| 804 | + k = scnprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr); |
---|
817 | 805 | for (i = 0; i < list->nr; i++) |
---|
818 | | - k += snprintf(str + k, PRIV_STR_SIZE - k, |
---|
| 806 | + k += scnprintf(str + k, PRIV_STR_SIZE - k, |
---|
819 | 807 | "bss[%u] :\nage=%u\nchannel=%u\n" |
---|
820 | 808 | "capinfo=0x%X\nrates=0x%X\n" |
---|
821 | 809 | "basic_rates=0x%X\n", |
---|
.. | .. |
---|
831 | 819 | struct obj_frequencies *freq = r->ptr; |
---|
832 | 820 | int i, t; |
---|
833 | 821 | printk("nr : %u\n", freq->nr); |
---|
834 | | - t = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr); |
---|
| 822 | + t = scnprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr); |
---|
835 | 823 | for (i = 0; i < freq->nr; i++) |
---|
836 | | - t += snprintf(str + t, PRIV_STR_SIZE - t, |
---|
| 824 | + t += scnprintf(str + t, PRIV_STR_SIZE - t, |
---|
837 | 825 | "mhz[%u]=%u\n", i, freq->mhz[i]); |
---|
838 | 826 | return t; |
---|
839 | 827 | } |
---|
840 | 828 | break; |
---|
841 | 829 | case OID_TYPE_MLME:{ |
---|
842 | 830 | struct obj_mlme *mlme = r->ptr; |
---|
843 | | - return snprintf(str, PRIV_STR_SIZE, |
---|
| 831 | + return scnprintf(str, PRIV_STR_SIZE, |
---|
844 | 832 | "id=0x%X\nstate=0x%X\ncode=0x%X\n", |
---|
845 | 833 | mlme->id, mlme->state, mlme->code); |
---|
846 | 834 | } |
---|
847 | 835 | break; |
---|
848 | 836 | case OID_TYPE_MLMEEX:{ |
---|
849 | 837 | struct obj_mlmeex *mlme = r->ptr; |
---|
850 | | - return snprintf(str, PRIV_STR_SIZE, |
---|
| 838 | + return scnprintf(str, PRIV_STR_SIZE, |
---|
851 | 839 | "id=0x%X\nstate=0x%X\n" |
---|
852 | 840 | "code=0x%X\nsize=0x%X\n", mlme->id, |
---|
853 | 841 | mlme->state, mlme->code, mlme->size); |
---|
.. | .. |
---|
855 | 843 | break; |
---|
856 | 844 | case OID_TYPE_ATTACH:{ |
---|
857 | 845 | struct obj_attachment *attach = r->ptr; |
---|
858 | | - return snprintf(str, PRIV_STR_SIZE, |
---|
| 846 | + return scnprintf(str, PRIV_STR_SIZE, |
---|
859 | 847 | "id=%d\nsize=%d\n", |
---|
860 | 848 | attach->id, |
---|
861 | 849 | attach->size); |
---|
.. | .. |
---|
863 | 851 | break; |
---|
864 | 852 | case OID_TYPE_SSID:{ |
---|
865 | 853 | struct obj_ssid *ssid = r->ptr; |
---|
866 | | - return snprintf(str, PRIV_STR_SIZE, |
---|
| 854 | + return scnprintf(str, PRIV_STR_SIZE, |
---|
867 | 855 | "length=%u\noctets=%.*s\n", |
---|
868 | 856 | ssid->length, ssid->length, |
---|
869 | 857 | ssid->octets); |
---|
.. | .. |
---|
872 | 860 | case OID_TYPE_KEY:{ |
---|
873 | 861 | struct obj_key *key = r->ptr; |
---|
874 | 862 | int t, i; |
---|
875 | | - t = snprintf(str, PRIV_STR_SIZE, |
---|
| 863 | + t = scnprintf(str, PRIV_STR_SIZE, |
---|
876 | 864 | "type=0x%X\nlength=0x%X\nkey=0x", |
---|
877 | 865 | key->type, key->length); |
---|
878 | 866 | for (i = 0; i < key->length; i++) |
---|
879 | | - t += snprintf(str + t, PRIV_STR_SIZE - t, |
---|
| 867 | + t += scnprintf(str + t, PRIV_STR_SIZE - t, |
---|
880 | 868 | "%02X:", key->key[i]); |
---|
881 | | - t += snprintf(str + t, PRIV_STR_SIZE - t, "\n"); |
---|
| 869 | + t += scnprintf(str + t, PRIV_STR_SIZE - t, "\n"); |
---|
882 | 870 | return t; |
---|
883 | 871 | } |
---|
884 | 872 | break; |
---|
.. | .. |
---|
886 | 874 | case OID_TYPE_ADDR:{ |
---|
887 | 875 | unsigned char *buff = r->ptr; |
---|
888 | 876 | int t, i; |
---|
889 | | - t = snprintf(str, PRIV_STR_SIZE, "hex data="); |
---|
| 877 | + t = scnprintf(str, PRIV_STR_SIZE, "hex data="); |
---|
890 | 878 | for (i = 0; i < isl_oid[n].size; i++) |
---|
891 | | - t += snprintf(str + t, PRIV_STR_SIZE - t, |
---|
| 879 | + t += scnprintf(str + t, PRIV_STR_SIZE - t, |
---|
892 | 880 | "%02X:", buff[i]); |
---|
893 | | - t += snprintf(str + t, PRIV_STR_SIZE - t, "\n"); |
---|
| 881 | + t += scnprintf(str + t, PRIV_STR_SIZE - t, "\n"); |
---|
894 | 882 | return t; |
---|
895 | 883 | } |
---|
896 | 884 | break; |
---|