Skip to content

Commit

Permalink
ppp: mppe: Use vsnprintf extension %phN
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Joe Perches authored and David S. Miller committed Jun 6, 2017
1 parent f8fe997 commit 4f5a984
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions drivers/net/ppp/ppp_mppe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit 4f5a984

Please sign in to comment.