Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1566996 > unrolled thread

[PATCH] [net-next] ISDN: eicon: reduce stack size of sig_ind function

Started byArnd Bergmann <arnd@arndb.de>
First post2017-01-25 23:20 +0100
Last post2017-01-26 21:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] [net-next] ISDN: eicon: reduce stack size of sig_ind function Arnd Bergmann <arnd@arndb.de> - 2017-01-25 23:20 +0100
    Re: [PATCH] [net-next] ISDN: eicon: reduce stack size of sig_ind  function David Miller <davem@davemloft.net> - 2017-01-26 21:00 +0100

#1566996 — [PATCH] [net-next] ISDN: eicon: reduce stack size of sig_ind function

FromArnd Bergmann <arnd@arndb.de>
Date2017-01-25 23:20 +0100
Subject[PATCH] [net-next] ISDN: eicon: reduce stack size of sig_ind function
Message-ID<t3E53-7DH-11@gated-at.bofh.it>
I noticed that this function uses a lot of kernel stack when the
"latent entropy" plugin is enabled:

drivers/isdn/hardware/eicon/message.c: In function 'sig_ind':
drivers/isdn/hardware/eicon/message.c:6113:1: error: the frame size of 1168 bytes is larger than 1152 bytes [-Werror=frame-larger-than=]

We currently don't warn about this, as we raise the warning limit
to 2048 bytes in mainline, but I'd like to lower that limit again
in the future, and this function can easily be changed to be more
efficient and avoid that warning, by making some of its local
variables 'const'.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/isdn/hardware/eicon/message.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index 1a1d99704fe6..5dcfa2913ceb 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -147,7 +147,7 @@ static word plci_remove_check(PLCI *);
 static void listen_check(DIVA_CAPI_ADAPTER *);
 static byte AddInfo(byte **, byte **, byte *, byte *);
 static byte getChannel(API_PARSE *);
-static void IndParse(PLCI *, word *, byte **, byte);
+static void IndParse(PLCI *, const word *, byte **, byte);
 static byte ie_compare(byte *, byte *);
 static word find_cip(DIVA_CAPI_ADAPTER *, byte *, byte *);
 static word CPN_filter_ok(byte *cpn, DIVA_CAPI_ADAPTER *, word);
@@ -4858,7 +4858,7 @@ static void sig_ind(PLCI *plci)
 	/* included before the ESC_MSGTYPE and MAXPARMSIDS has to be incremented */
 	/* SMSG is situated at the end because its 0 (for compatibility reasons */
 	/* (see Info_Mask Bit 4, first IE. then the message type)           */
-	word parms_id[] =
+	static const word parms_id[] =
 		{MAXPARMSIDS, CPN, 0xff, DSA, OSA, BC, LLC, HLC, ESC_CAUSE, DSP, DT, CHA,
 		 UUI, CONG_RR, CONG_RNR, ESC_CHI, KEY, CHI, CAU, ESC_LAW,
 		 RDN, RDX, CONN_NR, RIN, NI, CAI, ESC_CR,
@@ -4866,12 +4866,12 @@ static void sig_ind(PLCI *plci)
 	/* 14 FTY repl by ESC_CHI */
 	/* 18 PI  repl by ESC_LAW */
 	/* removed OAD changed to 0xff for future use, OAD is multiIE now */
-	word multi_fac_id[] = {1, FTY};
-	word multi_pi_id[]  = {1, PI};
-	word multi_CiPN_id[]  = {1, OAD};
-	word multi_ssext_id[]  = {1, ESC_SSEXT};
+	static const word multi_fac_id[] = {1, FTY};
+	static const word multi_pi_id[]  = {1, PI};
+	static const word multi_CiPN_id[]  = {1, OAD};
+	static const word multi_ssext_id[]  = {1, ESC_SSEXT};
 
-	word multi_vswitch_id[]  = {1, ESC_VSWITCH};
+	static const word multi_vswitch_id[]  = {1, ESC_VSWITCH};
 
 	byte *cau;
 	word ncci;
@@ -8924,7 +8924,7 @@ static void listen_check(DIVA_CAPI_ADAPTER *a)
 /* functions for all parameters sent in INDs                        */
 /*------------------------------------------------------------------*/
 
-static void IndParse(PLCI *plci, word *parms_id, byte **parms, byte multiIEsize)
+static void IndParse(PLCI *plci, const word *parms_id, byte **parms, byte multiIEsize)
 {
 	word ploc;            /* points to current location within packet */
 	byte w;
-- 
2.9.0

[toc] | [next] | [standalone]


#1567672 — Re: [PATCH] [net-next] ISDN: eicon: reduce stack size of sig_ind function

FromDavid Miller <davem@davemloft.net>
Date2017-01-26 21:00 +0100
SubjectRe: [PATCH] [net-next] ISDN: eicon: reduce stack size of sig_ind function
Message-ID<t3Yn7-30B-1@gated-at.bofh.it>
In reply to#1566996
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 25 Jan 2017 23:15:53 +0100

> I noticed that this function uses a lot of kernel stack when the
> "latent entropy" plugin is enabled:
> 
> drivers/isdn/hardware/eicon/message.c: In function 'sig_ind':
> drivers/isdn/hardware/eicon/message.c:6113:1: error: the frame size of 1168 bytes is larger than 1152 bytes [-Werror=frame-larger-than=]
> 
> We currently don't warn about this, as we raise the warning limit
> to 2048 bytes in mainline, but I'd like to lower that limit again
> in the future, and this function can easily be changed to be more
> efficient and avoid that warning, by making some of its local
> variables 'const'.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thanks Arnd.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web