History

sysctl: simplify ->strategy

name and nlen parameters passed to ->strategy hook are unused, remove them. In general ->strategy hook should know what it's doing, and don't do something tricky for which, say, pointer to original userspace array may be needed (name).

Alexey Dobriyan committed 18 years ago

Commit f221e721 parent f40cbaa16 files · +56 −73Browse files

Unified · Split

16 files
  1. arch/frv/kernel/pm.c +3 −3
  2. arch/mips/lasat/sysctl.c +8 −9
  3. drivers/char/random.c +1 −1
  4. include/linux/sysctl.h +1 −1
  5. include/net/ip.h +1 −1
  6. include/net/ndisc.h +2 −3
  7. ipc/ipc_sysctl.c +4 −5
  8. kernel/sysctl.c +13 −16
  9. kernel/utsname_sysctl.c +2 −3
  10. net/decnet/dn_dev.c +2 −2
  11. net/decnet/sysctl_net_decnet.c +2 −2
  12. net/ipv4/devinet.c +3 −4
  13. net/ipv4/route.c +1 −6
  14. net/ipv4/sysctl_net_ipv4.c +9 −9
  15. net/ipv6/addrconf.c +0 −1
  16. net/ipv6/ndisc.c +4 −7
arch/frv/kernel/pm.c+3−3
@@ -211,7 +211,7 @@ static int cmode_procctl(ctl_table *ctl, int write, struct file *filp, · 210 unmodified lines
211 return try_set_cmode(new_cmode)?:*lenp;211 return try_set_cmode(new_cmode)?:*lenp;
212}212}
213 213
214static int cmode_sysctl(ctl_table *table, int __user *name, int nlen,214static int cmode_sysctl(ctl_table *table,
215 void __user *oldval, size_t __user *oldlenp,215 void __user *oldval, size_t __user *oldlenp,
216 void __user *newval, size_t newlen)216 void __user *newval, size_t newlen)
217{217{
@@ -314,7 +314,7 @@ static int p0_procctl(ctl_table *ctl, int write, struct file *filp, · 96 unmodified lines
314 return try_set_p0(new_p0)?:*lenp;314 return try_set_p0(new_p0)?:*lenp;
315}315}
316 316
317static int p0_sysctl(ctl_table *table, int __user *name, int nlen,317static int p0_sysctl(ctl_table *table,
318 void __user *oldval, size_t __user *oldlenp,318 void __user *oldval, size_t __user *oldlenp,
319 void __user *newval, size_t newlen)319 void __user *newval, size_t newlen)
320{320{
@@ -358,7 +358,7 @@ static int cm_procctl(ctl_table *ctl, int write, struct file *filp, · 37 unmodified lines
358 return try_set_cm(new_cm)?:*lenp;358 return try_set_cm(new_cm)?:*lenp;
359}359}
360 360
361static int cm_sysctl(ctl_table *table, int __user *name, int nlen,361static int cm_sysctl(ctl_table *table,
362 void __user *oldval, size_t __user *oldlenp,362 void __user *oldval, size_t __user *oldlenp,
363 void __user *newval, size_t newlen)363 void __user *newval, size_t newlen)
364{364{
arch/mips/lasat/sysctl.c+8−9
@@ -38,14 +38,13 @@ · 37 unmodified lines
38#endif38#endif
39 39
40/* Strategy function to write EEPROM after changing string entry */40/* Strategy function to write EEPROM after changing string entry */
41int sysctl_lasatstring(ctl_table *table, int *name, int nlen,41int sysctl_lasatstring(ctl_table *table,
42 void *oldval, size_t *oldlenp,42 void *oldval, size_t *oldlenp,
43 void *newval, size_t newlen)43 void *newval, size_t newlen)
44{44{
45 int r;45 int r;
46 46
47 r = sysctl_string(table, name,47 r = sysctl_string(table, oldval, oldlenp, newval, newlen);
48 nlen, oldval, oldlenp, newval, newlen);
49 if (r < 0)48 if (r < 0)
50 return r;49 return r;
51 50
@@ -113,13 +112,13 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp, · 61 unmodified lines
113#endif112#endif
114 113
115/* Sysctl for setting the IP addresses */114/* Sysctl for setting the IP addresses */
116int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen,115int sysctl_lasat_intvec(ctl_table *table,
117 void *oldval, size_t *oldlenp,116 void *oldval, size_t *oldlenp,
118 void *newval, size_t newlen)117 void *newval, size_t newlen)
119{118{
120 int r;119 int r;
121 120
122 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);121 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
123 if (r < 0)122 if (r < 0)
124 return r;123 return r;
125 124
@@ -131,7 +130,7 @@ int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen, · 5 unmodified lines
131 130
132#ifdef CONFIG_DS1603131#ifdef CONFIG_DS1603
133/* Same for RTC */132/* Same for RTC */
134int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen,133int sysctl_lasat_rtc(ctl_table *table,
135 void *oldval, size_t *oldlenp,134 void *oldval, size_t *oldlenp,
136 void *newval, size_t newlen)135 void *newval, size_t newlen)
137{136{
@@ -140,7 +139,7 @@ int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen, · 2 unmodified lines
140 rtctmp = read_persistent_clock();139 rtctmp = read_persistent_clock();
141 if (rtctmp < 0)140 if (rtctmp < 0)
142 rtctmp = 0;141 rtctmp = 0;
143 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);142 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
144 if (r < 0)143 if (r < 0)
145 return r;144 return r;
146 if (newval && newlen)145 if (newval && newlen)
@@ -211,13 +210,13 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, · 64 unmodified lines
211}210}
212#endif211#endif
213 212
214static int sysctl_lasat_prid(ctl_table *table, int *name, int nlen,213static int sysctl_lasat_prid(ctl_table *table,
215 void *oldval, size_t *oldlenp,214 void *oldval, size_t *oldlenp,
216 void *newval, size_t newlen)215 void *newval, size_t newlen)
217{216{
218 int r;217 int r;
219 218
220 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);219 r = sysctl_intvec(table, oldval, oldlenp, newval, newlen);
221 if (r < 0)220 if (r < 0)
222 return r;221 return r;
223 if (newval && newlen) {222 if (newval && newlen) {
drivers/char/random.c+1−1
@@ -1205,7 +1205,7 @@ static int proc_do_uuid(ctl_table *table, int write, struct file *filp, · 1204 unmodified lines
1205 return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);1205 return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);
1206}1206}
1207 1207
1208static int uuid_strategy(ctl_table *table, int __user *name, int nlen,1208static int uuid_strategy(ctl_table *table,
1209 void __user *oldval, size_t __user *oldlenp,1209 void __user *oldval, size_t __user *oldlenp,
1210 void __user *newval, size_t newlen)1210 void __user *newval, size_t newlen)
1211{1211{
include/linux/sysctl.h+1−1
@@ -972,7 +972,7 @@ extern int sysctl_perm(struct ctl_table_root *root, · 971 unmodified lines
972 972
973typedef struct ctl_table ctl_table;973typedef struct ctl_table ctl_table;
974 974
975typedef int ctl_handler (struct ctl_table *table, int __user *name, int nlen,975typedef int ctl_handler (struct ctl_table *table,
976 void __user *oldval, size_t __user *oldlenp,976 void __user *oldval, size_t __user *oldlenp,
977 void __user *newval, size_t newlen);977 void __user *newval, size_t newlen);
978 978
include/net/ip.h+1−1
@@ -396,7 +396,7 @@ extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, · 395 unmodified lines
396int ipv4_doint_and_flush(ctl_table *ctl, int write,396int ipv4_doint_and_flush(ctl_table *ctl, int write,
397 struct file* filp, void __user *buffer,397 struct file* filp, void __user *buffer,
398 size_t *lenp, loff_t *ppos);398 size_t *lenp, loff_t *ppos);
399int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,399int ipv4_doint_and_flush_strategy(ctl_table *table,
400 void __user *oldval, size_t __user *oldlenp,400 void __user *oldval, size_t __user *oldlenp,
401 void __user *newval, size_t newlen);401 void __user *newval, size_t newlen);
402#ifdef CONFIG_PROC_FS402#ifdef CONFIG_PROC_FS
include/net/ndisc.h+2−3
@@ -129,9 +129,8 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, · 128 unmodified lines
129 void __user *buffer,129 void __user *buffer,
130 size_t *lenp,130 size_t *lenp,
131 loff_t *ppos);131 loff_t *ppos);
132int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name,132int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl,
133 int nlen, void __user *oldval,133 void __user *oldval, size_t __user *oldlenp,
134 size_t __user *oldlenp,
135 void __user *newval, size_t newlen);134 void __user *newval, size_t newlen);
136#endif135#endif
137 136
ipc/ipc_sysctl.c+4−5
@@ -131,7 +131,7 @@ static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, · 130 unmodified lines
131 131
132#ifdef CONFIG_SYSCTL_SYSCALL132#ifdef CONFIG_SYSCTL_SYSCALL
133/* The generic sysctl ipc data routine. */133/* The generic sysctl ipc data routine. */
134static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,134static int sysctl_ipc_data(ctl_table *table,
135 void __user *oldval, size_t __user *oldlenp,135 void __user *oldval, size_t __user *oldlenp,
136 void __user *newval, size_t newlen)136 void __user *newval, size_t newlen)
137{137{
@@ -169,14 +169,13 @@ static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen, · 31 unmodified lines
169 return 1;169 return 1;
170}170}
171 171
172static int sysctl_ipc_registered_data(ctl_table *table, int __user *name,172static int sysctl_ipc_registered_data(ctl_table *table,
173 int nlen, void __user *oldval, size_t __user *oldlenp,173 void __user *oldval, size_t __user *oldlenp,
174 void __user *newval, size_t newlen)174 void __user *newval, size_t newlen)
175{175{
176 int rc;176 int rc;
177 177
178 rc = sysctl_ipc_data(table, name, nlen, oldval, oldlenp, newval,178 rc = sysctl_ipc_data(table, oldval, oldlenp, newval, newlen);
179 newlen);
180 179
181 if (newval && newlen && rc > 0)180 if (newval && newlen && rc > 0)
182 /*181 /*
kernel/sysctl.c+13−16
@@ -1500,7 +1500,6 @@ void register_sysctl_root(struct ctl_table_root *root) · 1499 unmodified lines
1500/* Perform the actual read/write of a sysctl table entry. */1500/* Perform the actual read/write of a sysctl table entry. */
1501static int do_sysctl_strategy(struct ctl_table_root *root,1501static int do_sysctl_strategy(struct ctl_table_root *root,
1502 struct ctl_table *table,1502 struct ctl_table *table,
1503 int __user *name, int nlen,
1504 void __user *oldval, size_t __user *oldlenp,1503 void __user *oldval, size_t __user *oldlenp,
1505 void __user *newval, size_t newlen)1504 void __user *newval, size_t newlen)
1506{1505{
@@ -1514,8 +1513,7 @@ static int do_sysctl_strategy(struct ctl_table_root *root, · 7 unmodified lines
1514 return -EPERM;1513 return -EPERM;
1515 1514
1516 if (table->strategy) {1515 if (table->strategy) {
1517 rc = table->strategy(table, name, nlen, oldval, oldlenp,1516 rc = table->strategy(table, oldval, oldlenp, newval, newlen);
1518 newval, newlen);
1519 if (rc < 0)1517 if (rc < 0)
1520 return rc;1518 return rc;
1521 if (rc > 0)1519 if (rc > 0)
@@ -1525,8 +1523,7 @@ static int do_sysctl_strategy(struct ctl_table_root *root, · 3 unmodified lines
1525 /* If there is no strategy routine, or if the strategy returns1523 /* If there is no strategy routine, or if the strategy returns
1526 * zero, proceed with automatic r/w */1524 * zero, proceed with automatic r/w */
1527 if (table->data && table->maxlen) {1525 if (table->data && table->maxlen) {
1528 rc = sysctl_data(table, name, nlen, oldval, oldlenp,1526 rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
1529 newval, newlen);
1530 if (rc < 0)1527 if (rc < 0)
1531 return rc;1528 return rc;
1532 }1529 }
@@ -1558,7 +1555,7 @@ repeat: · 25 unmodified lines
1558 table = table->child;1555 table = table->child;
1559 goto repeat;1556 goto repeat;
1560 }1557 }
1561 error = do_sysctl_strategy(root, table, name, nlen,1558 error = do_sysctl_strategy(root, table,
1562 oldval, oldlenp,1559 oldval, oldlenp,
1563 newval, newlen);1560 newval, newlen);
1564 return error;1561 return error;
@@ -2707,7 +2704,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write, · 1142 unmodified lines
2707 */2704 */
2708 2705
2709/* The generic sysctl data routine (used if no strategy routine supplied) */2706/* The generic sysctl data routine (used if no strategy routine supplied) */
2710int sysctl_data(struct ctl_table *table, int __user *name, int nlen,2707int sysctl_data(struct ctl_table *table,
2711 void __user *oldval, size_t __user *oldlenp,2708 void __user *oldval, size_t __user *oldlenp,
2712 void __user *newval, size_t newlen)2709 void __user *newval, size_t newlen)
2713{2710{
@@ -2741,7 +2738,7 @@ int sysctl_data(struct ctl_table *table, int __user *name, int nlen, · 27 unmodified lines
2741}2738}
2742 2739
2743/* The generic string strategy routine: */2740/* The generic string strategy routine: */
2744int sysctl_string(struct ctl_table *table, int __user *name, int nlen,2741int sysctl_string(struct ctl_table *table,
2745 void __user *oldval, size_t __user *oldlenp,2742 void __user *oldval, size_t __user *oldlenp,
2746 void __user *newval, size_t newlen)2743 void __user *newval, size_t newlen)
2747{2744{
@@ -2787,7 +2784,7 @@ int sysctl_string(struct ctl_table *table, int __user *name, int nlen, · 39 unmodified lines
2787 * are between the minimum and maximum values given in the arrays2784 * are between the minimum and maximum values given in the arrays
2788 * table->extra1 and table->extra2, respectively.2785 * table->extra1 and table->extra2, respectively.
2789 */2786 */
2790int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,2787int sysctl_intvec(struct ctl_table *table,
2791 void __user *oldval, size_t __user *oldlenp,2788 void __user *oldval, size_t __user *oldlenp,
2792 void __user *newval, size_t newlen)2789 void __user *newval, size_t newlen)
2793{2790{
@@ -2823,7 +2820,7 @@ int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen, · 29 unmodified lines
2823}2820}
2824 2821
2825/* Strategy function to convert jiffies to seconds */ 2822/* Strategy function to convert jiffies to seconds */
2826int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,2823int sysctl_jiffies(struct ctl_table *table,
2827 void __user *oldval, size_t __user *oldlenp,2824 void __user *oldval, size_t __user *oldlenp,
2828 void __user *newval, size_t newlen)2825 void __user *newval, size_t newlen)
2829{2826{
@@ -2857,7 +2854,7 @@ int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen, · 27 unmodified lines
2857}2854}
2858 2855
2859/* Strategy function to convert jiffies to seconds */ 2856/* Strategy function to convert jiffies to seconds */
2860int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,2857int sysctl_ms_jiffies(struct ctl_table *table,
2861 void __user *oldval, size_t __user *oldlenp,2858 void __user *oldval, size_t __user *oldlenp,
2862 void __user *newval, size_t newlen)2859 void __user *newval, size_t newlen)
2863{2860{
@@ -2912,35 +2909,35 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args) · 48 unmodified lines
2912 return error;2909 return error;
2913}2910}
2914 2911
2915int sysctl_data(struct ctl_table *table, int __user *name, int nlen,2912int sysctl_data(struct ctl_table *table,
2916 void __user *oldval, size_t __user *oldlenp,2913 void __user *oldval, size_t __user *oldlenp,
2917 void __user *newval, size_t newlen)2914 void __user *newval, size_t newlen)
2918{2915{
2919 return -ENOSYS;2916 return -ENOSYS;
2920}2917}
2921 2918
2922int sysctl_string(struct ctl_table *table, int __user *name, int nlen,2919int sysctl_string(struct ctl_table *table,
2923 void __user *oldval, size_t __user *oldlenp,2920 void __user *oldval, size_t __user *oldlenp,
2924 void __user *newval, size_t newlen)2921 void __user *newval, size_t newlen)
2925{2922{
2926 return -ENOSYS;2923 return -ENOSYS;
2927}2924}
2928 2925
2929int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,2926int sysctl_intvec(struct ctl_table *table,
2930 void __user *oldval, size_t __user *oldlenp,2927 void __user *oldval, size_t __user *oldlenp,
2931 void __user *newval, size_t newlen)2928 void __user *newval, size_t newlen)
2932{2929{
2933 return -ENOSYS;2930 return -ENOSYS;
2934}2931}
2935 2932
2936int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,2933int sysctl_jiffies(struct ctl_table *table,
2937 void __user *oldval, size_t __user *oldlenp,2934 void __user *oldval, size_t __user *oldlenp,
2938 void __user *newval, size_t newlen)2935 void __user *newval, size_t newlen)
2939{2936{
2940 return -ENOSYS;2937 return -ENOSYS;
2941}2938}
2942 2939
2943int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,2940int sysctl_ms_jiffies(struct ctl_table *table,
2944 void __user *oldval, size_t __user *oldlenp,2941 void __user *oldval, size_t __user *oldlenp,
2945 void __user *newval, size_t newlen)2942 void __user *newval, size_t newlen)
2946{2943{
kernel/utsname_sysctl.c+2−3
@@ -60,7 +60,7 @@ static int proc_do_uts_string(ctl_table *table, int write, struct file *filp, · 59 unmodified lines
60 60
61#ifdef CONFIG_SYSCTL_SYSCALL61#ifdef CONFIG_SYSCTL_SYSCALL
62/* The generic string strategy routine: */62/* The generic string strategy routine: */
63static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,63static int sysctl_uts_string(ctl_table *table,
64 void __user *oldval, size_t __user *oldlenp,64 void __user *oldval, size_t __user *oldlenp,
65 void __user *newval, size_t newlen)65 void __user *newval, size_t newlen)
66{66{
@@ -69,8 +69,7 @@ static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, · 2 unmodified lines
69 write = newval && newlen;69 write = newval && newlen;
70 memcpy(&uts_table, table, sizeof(uts_table));70 memcpy(&uts_table, table, sizeof(uts_table));
71 uts_table.data = get_uts(table, write);71 uts_table.data = get_uts(table, write);
72 r = sysctl_string(&uts_table, name, nlen,72 r = sysctl_string(&uts_table, oldval, oldlenp, newval, newlen);
73 oldval, oldlenp, newval, newlen);
74 put_uts(table, write, uts_table.data);73 put_uts(table, write, uts_table.data);
75 return r;74 return r;
76}75}
net/decnet/dn_dev.c+2−2
@@ -166,7 +166,7 @@ static int max_priority[] = { 127 }; /* From DECnet spec */ · 165 unmodified lines
166 166
167static int dn_forwarding_proc(ctl_table *, int, struct file *,167static int dn_forwarding_proc(ctl_table *, int, struct file *,
168 void __user *, size_t *, loff_t *);168 void __user *, size_t *, loff_t *);
169static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen,169static int dn_forwarding_sysctl(ctl_table *table,
170 void __user *oldval, size_t __user *oldlenp,170 void __user *oldval, size_t __user *oldlenp,
171 void __user *newval, size_t newlen);171 void __user *newval, size_t newlen);
172 172
@@ -318,7 +318,7 @@ static int dn_forwarding_proc(ctl_table *table, int write, · 145 unmodified lines
318#endif318#endif
319}319}
320 320
321static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen,321static int dn_forwarding_sysctl(ctl_table *table,
322 void __user *oldval, size_t __user *oldlenp,322 void __user *oldval, size_t __user *oldlenp,
323 void __user *newval, size_t newlen)323 void __user *newval, size_t newlen)
324{324{
net/decnet/sysctl_net_decnet.c+2−2
@@ -132,7 +132,7 @@ static int parse_addr(__le16 *addr, char *str) · 131 unmodified lines
132}132}
133 133
134 134
135static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen,135static int dn_node_address_strategy(ctl_table *table,
136 void __user *oldval, size_t __user *oldlenp,136 void __user *oldval, size_t __user *oldlenp,
137 void __user *newval, size_t newlen)137 void __user *newval, size_t newlen)
138{138{
@@ -217,7 +217,7 @@ static int dn_node_address_handler(ctl_table *table, int write, · 78 unmodified lines
217}217}
218 218
219 219
220static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen,220static int dn_def_dev_strategy(ctl_table *table,
221 void __user *oldval, size_t __user *oldlenp,221 void __user *oldval, size_t __user *oldlenp,
222 void __user *newval, size_t newlen)222 void __user *newval, size_t newlen)
223{223{
net/ipv4/devinet.c+3−4
@@ -1283,7 +1283,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write, · 1282 unmodified lines
1283 return ret;1283 return ret;
1284}1284}
1285 1285
1286static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen,1286static int devinet_conf_sysctl(ctl_table *table,
1287 void __user *oldval, size_t __user *oldlenp,1287 void __user *oldval, size_t __user *oldlenp,
1288 void __user *newval, size_t newlen)1288 void __user *newval, size_t newlen)
1289{1289{
@@ -1379,12 +1379,11 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write, · 89 unmodified lines
1379 return ret;1379 return ret;
1380}1380}
1381 1381
1382int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,1382int ipv4_doint_and_flush_strategy(ctl_table *table,
1383 void __user *oldval, size_t __user *oldlenp,1383 void __user *oldval, size_t __user *oldlenp,
1384 void __user *newval, size_t newlen)1384 void __user *newval, size_t newlen)
1385{1385{
1386 int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp,1386 int ret = devinet_conf_sysctl(table, oldval, oldlenp, newval, newlen);
1387 newval, newlen);
1388 struct net *net = table->extra2;1387 struct net *net = table->extra2;
1389 1388
1390 if (ret == 1)1389 if (ret == 1)
net/ipv4/route.c+1−6
@@ -2908,8 +2908,6 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, · 2907 unmodified lines
2908}2908}
2909 2909
2910static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,2910static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
2911 int __user *name,
2912 int nlen,
2913 void __user *oldval,2911 void __user *oldval,
2914 size_t __user *oldlenp,2912 size_t __user *oldlenp,
2915 void __user *newval,2913 void __user *newval,
@@ -2972,16 +2970,13 @@ static int ipv4_sysctl_rt_secret_interval(ctl_table *ctl, int write, · 56 unmodified lines
2972}2970}
2973 2971
2974static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table,2972static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table,
2975 int __user *name,
2976 int nlen,
2977 void __user *oldval,2973 void __user *oldval,
2978 size_t __user *oldlenp,2974 size_t __user *oldlenp,
2979 void __user *newval,2975 void __user *newval,
2980 size_t newlen)2976 size_t newlen)
2981{2977{
2982 int old = ip_rt_secret_interval;2978 int old = ip_rt_secret_interval;
2983 int ret = sysctl_jiffies(table, name, nlen, oldval, oldlenp, newval,2979 int ret = sysctl_jiffies(table, oldval, oldlenp, newval, newlen);
2984 newlen);
2985 2980
2986 rt_secret_reschedule(old);2981 rt_secret_reschedule(old);
2987 2982
net/ipv4/sysctl_net_ipv4.c+9−9
@@ -64,8 +64,8 @@ static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp, · 63 unmodified lines
64}64}
65 65
66/* Validate changes from sysctl interface. */66/* Validate changes from sysctl interface. */
67static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,67static int ipv4_sysctl_local_port_range(ctl_table *table,
68 int nlen, void __user *oldval,68 void __user *oldval,
69 size_t __user *oldlenp,69 size_t __user *oldlenp,
70 void __user *newval, size_t newlen)70 void __user *newval, size_t newlen)
71{71{
@@ -80,7 +80,7 @@ static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name, · 8 unmodified lines
80 };80 };
81 81
82 inet_get_local_port_range(range, range + 1);82 inet_get_local_port_range(range, range + 1);
83 ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen);83 ret = sysctl_intvec(&tmp, oldval, oldlenp, newval, newlen);
84 if (ret == 0 && newval && newlen) {84 if (ret == 0 && newval && newlen) {
85 if (range[1] < range[0])85 if (range[1] < range[0])
86 ret = -EINVAL;86 ret = -EINVAL;
@@ -109,8 +109,8 @@ static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file * · 22 unmodified lines
109 return ret;109 return ret;
110}110}
111 111
112static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,112static int sysctl_tcp_congestion_control(ctl_table *table,
113 int nlen, void __user *oldval,113 void __user *oldval,
114 size_t __user *oldlenp,114 size_t __user *oldlenp,
115 void __user *newval, size_t newlen)115 void __user *newval, size_t newlen)
116{116{
@@ -122,7 +122,7 @@ static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name, · 5 unmodified lines
122 int ret;122 int ret;
123 123
124 tcp_get_default_congestion_control(val);124 tcp_get_default_congestion_control(val);
125 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);125 ret = sysctl_string(&tbl, oldval, oldlenp, newval, newlen);
126 if (ret == 1 && newval && newlen)126 if (ret == 1 && newval && newlen)
127 ret = tcp_set_default_congestion_control(val);127 ret = tcp_set_default_congestion_control(val);
128 return ret;128 return ret;
@@ -165,8 +165,8 @@ static int proc_allowed_congestion_control(ctl_table *ctl, · 36 unmodified lines
165 return ret;165 return ret;
166}166}
167 167
168static int strategy_allowed_congestion_control(ctl_table *table, int __user *name,168static int strategy_allowed_congestion_control(ctl_table *table,
169 int nlen, void __user *oldval,169 void __user *oldval,
170 size_t __user *oldlenp,170 size_t __user *oldlenp,
171 void __user *newval,171 void __user *newval,
172 size_t newlen)172 size_t newlen)
@@ -179,7 +179,7 @@ static int strategy_allowed_congestion_control(ctl_table *table, int __user *nam · 6 unmodified lines
179 return -ENOMEM;179 return -ENOMEM;
180 180
181 tcp_get_available_congestion_control(tbl.data, tbl.maxlen);181 tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
182 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);182 ret = sysctl_string(&tbl, oldval, oldlenp, newval, newlen);
183 if (ret == 1 && newval && newlen)183 if (ret == 1 && newval && newlen)
184 ret = tcp_set_allowed_congestion_control(tbl.data);184 ret = tcp_set_allowed_congestion_control(tbl.data);
185 kfree(tbl.data);185 kfree(tbl.data);
net/ipv6/addrconf.c+0−1
@@ -3982,7 +3982,6 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp, · 3981 unmodified lines
3982}3982}
3983 3983
3984static int addrconf_sysctl_forward_strategy(ctl_table *table,3984static int addrconf_sysctl_forward_strategy(ctl_table *table,
3985 int __user *name, int nlen,
3986 void __user *oldval,3985 void __user *oldval,
3987 size_t __user *oldlenp,3986 size_t __user *oldlenp,
3988 void __user *newval, size_t newlen)3987 void __user *newval, size_t newlen)
net/ipv6/ndisc.c+4−7
@@ -1730,9 +1730,8 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f · 1729 unmodified lines
1730 return ret;1730 return ret;
1731}1731}
1732 1732
1733int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name,1733int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl,
1734 int nlen, void __user *oldval,1734 void __user *oldval, size_t __user *oldlenp,
1735 size_t __user *oldlenp,
1736 void __user *newval, size_t newlen)1735 void __user *newval, size_t newlen)
1737{1736{
1738 struct net_device *dev = ctl->extra1;1737 struct net_device *dev = ctl->extra1;
@@ -1745,13 +1744,11 @@ int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, · 6 unmodified lines
1745 1744
1746 switch (ctl->ctl_name) {1745 switch (ctl->ctl_name) {
1747 case NET_NEIGH_REACHABLE_TIME:1746 case NET_NEIGH_REACHABLE_TIME:
1748 ret = sysctl_jiffies(ctl, name, nlen,1747 ret = sysctl_jiffies(ctl, oldval, oldlenp, newval, newlen);
1749 oldval, oldlenp, newval, newlen);
1750 break;1748 break;
1751 case NET_NEIGH_RETRANS_TIME_MS:1749 case NET_NEIGH_RETRANS_TIME_MS:
1752 case NET_NEIGH_REACHABLE_TIME_MS:1750 case NET_NEIGH_REACHABLE_TIME_MS:
1753 ret = sysctl_ms_jiffies(ctl, name, nlen,1751 ret = sysctl_ms_jiffies(ctl, oldval, oldlenp, newval, newlen);
1754 oldval, oldlenp, newval, newlen);
1755 break;1752 break;
1756 default:1753 default:
1757 ret = 0;1754 ret = 0;