linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ppp: mppe: Use vsnprintf extension %phN
@ 2017-06-05 12:22 Joe Perches
  2017-06-06 19:16 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2017-06-05 12:22 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linux-ppp, netdev, linux-kernel

Using this extension reduces the object size.

$ size drivers/net/ppp/ppp_mppe.o*
   text	   data	    bss	    dec	    hex	filename
   5683	    216	      8	   5907	   1713	drivers/net/ppp/ppp_mppe.o.new
   5808	    216	      8	   6032	   1790	drivers/net/ppp/ppp_mppe.o.old

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/ppp/ppp_mppe.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c
index f60f7660b451..6c7fd98cb00a 100644
--- a/drivers/net/ppp/ppp_mppe.c
+++ b/drivers/net/ppp/ppp_mppe.c
@@ -298,21 +298,14 @@ mppe_init(void *arg, unsigned char *options, int optlen, int unit, int debug,
 	mppe_rekey(state, 1);
 
 	if (debug) {
-		int i;
-		char mkey[sizeof(state->master_key) * 2 + 1];
-		char skey[sizeof(state->session_key) * 2 + 1];
-
 		printk(KERN_DEBUG "%s[%d]: initialized with %d-bit %s mode\n",
 		       debugstr, unit, (state->keylen = 16) ? 128 : 40,
 		       (state->stateful) ? "stateful" : "stateless");
-
-		for (i = 0; i < sizeof(state->master_key); i++)
-			sprintf(mkey + i * 2, "%02x", state->master_key[i]);
-		for (i = 0; i < sizeof(state->session_key); i++)
-			sprintf(skey + i * 2, "%02x", state->session_key[i]);
 		printk(KERN_DEBUG
-		       "%s[%d]: keys: master: %s initial session: %s\n",
-		       debugstr, unit, mkey, skey);
+		       "%s[%d]: keys: master: %*phN initial session: %*phN\n",
+		       debugstr, unit,
+		       (int)sizeof(state->master_key), state->master_key,
+		       (int)sizeof(state->session_key), state->session_key);
 	}
 
 	/*
-- 
2.10.0.rc2.1.g053435c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ppp: mppe: Use vsnprintf extension %phN
  2017-06-05 12:22 [PATCH] ppp: mppe: Use vsnprintf extension %phN Joe Perches
@ 2017-06-06 19:16 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-06-06 19:16 UTC (permalink / raw)
  To: joe; +Cc: paulus, linux-ppp, netdev, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Mon,  5 Jun 2017 05:22:50 -0700

> Using this extension reduces the object size.
> 
> $ size drivers/net/ppp/ppp_mppe.o*
>    text	   data	    bss	    dec	    hex	filename
>    5683	    216	      8	   5907	   1713	drivers/net/ppp/ppp_mppe.o.new
>    5808	    216	      8	   6032	   1790	drivers/net/ppp/ppp_mppe.o.old
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied to net-next, thanks Joe.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-06 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-05 12:22 [PATCH] ppp: mppe: Use vsnprintf extension %phN Joe Perches
2017-06-06 19:16 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).