Re: [linux-vrf-core] [PATCHLET] Check ioctl parameters.
Status: Beta
Brought to you by:
jleu
From: James R. L. <jl...@mi...> - 2003-01-03 19:00:22
|
Patch applied. On Thu, Jan 02, 2003 at 01:39:55PM +0100, Yon Uriarte wrote: > Hi, > > Do not happily overwrite memory. A better solution could be to just > #define VRF_MAX 256 > and forget about it (there is cast in the af_inet.c call, so the check > would be redundant). Wasted memory is not an issue ( less than 1Kbyte). > > And a happy new year, > yon > > > --- net/ipv4/orig2.fib_rules.c Thu Jan 2 13:12:03 2003 > +++ net/ipv4/fib_rules.c Thu Jan 2 13:35:16 2003 > @@ -466,6 +466,7 @@ void do_fib_del_vrf(struct fib_rule *rul > > int fib_del_vrf(unsigned char vrf) { > > + if (vrf >= VRF_MAX) return -EINVAL; > if (!vrf || fib_rules[vrf] == NULL) { > return 0; > } > @@ -484,6 +485,7 @@ int fib_add_vrf(unsigned char vrf) { > struct fib_rule *main_rule; > struct fib_rule *loc_rule; > > + if (vrf >= VRF_MAX) return -EINVAL; > if (fib_rules[vrf]) return -EEXIST; > > df_rule = kmalloc(sizeof(struct fib_rule),GFP_KERNEL); -- James R. Leu |