mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
sctp: use KMALLOC_MAX_SIZE instead of its own MAX_KMALLOC_SIZE
Don't definite its own MAX_KMALLOC_SIZE, use the one defined in mm. Cc: Vlad Yasevich <vyasevich@gmail.com> Cc: Sridhar Samudrala <sri@us.ibm.com> Cc: Neil Horman <nhorman@tuxdriver.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ece6b0a2b2
commit
3f736868b4
1 changed files with 3 additions and 5 deletions
|
@ -41,8 +41,6 @@
|
||||||
#include <net/sctp/sctp.h>
|
#include <net/sctp/sctp.h>
|
||||||
#include <net/sctp/sm.h>
|
#include <net/sctp/sm.h>
|
||||||
|
|
||||||
#define MAX_KMALLOC_SIZE 131072
|
|
||||||
|
|
||||||
static struct sctp_ssnmap *sctp_ssnmap_init(struct sctp_ssnmap *map, __u16 in,
|
static struct sctp_ssnmap *sctp_ssnmap_init(struct sctp_ssnmap *map, __u16 in,
|
||||||
__u16 out);
|
__u16 out);
|
||||||
|
|
||||||
|
@ -65,7 +63,7 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
size = sctp_ssnmap_size(in, out);
|
size = sctp_ssnmap_size(in, out);
|
||||||
if (size <= MAX_KMALLOC_SIZE)
|
if (size <= KMALLOC_MAX_SIZE)
|
||||||
retval = kmalloc(size, gfp);
|
retval = kmalloc(size, gfp);
|
||||||
else
|
else
|
||||||
retval = (struct sctp_ssnmap *)
|
retval = (struct sctp_ssnmap *)
|
||||||
|
@ -82,7 +80,7 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
fail_map:
|
fail_map:
|
||||||
if (size <= MAX_KMALLOC_SIZE)
|
if (size <= KMALLOC_MAX_SIZE)
|
||||||
kfree(retval);
|
kfree(retval);
|
||||||
else
|
else
|
||||||
free_pages((unsigned long)retval, get_order(size));
|
free_pages((unsigned long)retval, get_order(size));
|
||||||
|
@ -124,7 +122,7 @@ void sctp_ssnmap_free(struct sctp_ssnmap *map)
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
size = sctp_ssnmap_size(map->in.len, map->out.len);
|
size = sctp_ssnmap_size(map->in.len, map->out.len);
|
||||||
if (size <= MAX_KMALLOC_SIZE)
|
if (size <= KMALLOC_MAX_SIZE)
|
||||||
kfree(map);
|
kfree(map);
|
||||||
else
|
else
|
||||||
free_pages((unsigned long)map, get_order(size));
|
free_pages((unsigned long)map, get_order(size));
|
||||||
|
|
Loading…
Reference in a new issue