caif: reduce stack size with KASAN

When CONFIG_KASAN is set, we can use relatively large amounts of kernel
stack space:

net/caif/cfctrl.c:555:1: warning: the frame size of 1600 bytes is larger than 1280 bytes [-Wframe-larger-than=]

This adds convenience wrappers around cfpkt_extr_head(), which is responsible
for most of the stack growth. With those wrapper functions, gcc apparently
starts reusing the stack slots for each instance, thus avoiding the
problem.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Arnd Bergmann
2018-01-16 17:34:00 +01:00
committed by David S. Miller
parent aa73dc95b2
commit ce6289661b
2 changed files with 49 additions and 28 deletions

View File

@@ -32,6 +32,33 @@ void cfpkt_destroy(struct cfpkt *pkt);
*/
int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len);
static inline u8 cfpkt_extr_head_u8(struct cfpkt *pkt)
{
u8 tmp;
cfpkt_extr_head(pkt, &tmp, 1);
return tmp;
}
static inline u16 cfpkt_extr_head_u16(struct cfpkt *pkt)
{
__le16 tmp;
cfpkt_extr_head(pkt, &tmp, 2);
return le16_to_cpu(tmp);
}
static inline u32 cfpkt_extr_head_u32(struct cfpkt *pkt)
{
__le32 tmp;
cfpkt_extr_head(pkt, &tmp, 4);
return le32_to_cpu(tmp);
}
/*
* Peek header from packet.
* Reads data from packet without changing packet.