netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [XFRM]: alg_key_len should be unsigned to avoid integer divides
@ 2008-01-12 17:29 Eric Dumazet
  2008-01-13  5:32 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2008-01-12 17:29 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

alg_key_len is currently defined as 'signed int'. This unfortunatly leads
to integer divides in several paths.

Converting it to unsigned is safe and saves 208 bytes of text on i386.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>


[-- Attachment #2: xfrm_alg_key_len.patch --]
[-- Type: text/plain, Size: 333 bytes --]

diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 1131eab..f8507ee 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -92,7 +92,7 @@ struct xfrm_replay_state
 
 struct xfrm_algo {
 	char	alg_name[64];
-	int	alg_key_len;    /* in bits */
+	unsigned int	alg_key_len;    /* in bits */
 	char	alg_key[0];
 };
 

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

* Re: [XFRM]: alg_key_len should be unsigned to avoid integer divides
  2008-01-12 17:29 [XFRM]: alg_key_len should be unsigned to avoid integer divides Eric Dumazet
@ 2008-01-13  5:32 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-01-13  5:32 UTC (permalink / raw)
  To: dada1; +Cc: netdev

From: Eric Dumazet <dada1@cosmosbay.com>
Date: Sat, 12 Jan 2008 18:29:32 +0100

> alg_key_len is currently defined as 'signed int'. This unfortunatly leads
> to integer divides in several paths.
> 
> Converting it to unsigned is safe and saves 208 bytes of text on i386.
> 
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

Applied.

I realigned the struct members in a follow-on changeset.

commit 7305e737926be49e09718df53f4285bf69cc3755
Author: David S. Miller <davem@davemloft.net>
Date:   Sat Jan 12 21:31:29 2008 -0800

    [XFRM]: Fix struct xfrm_algo code formatting.
    
    Realign struct members.
    
    Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index f8507ee..9b5b00c 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -91,9 +91,9 @@ struct xfrm_replay_state
 };
 
 struct xfrm_algo {
-	char	alg_name[64];
+	char		alg_name[64];
 	unsigned int	alg_key_len;    /* in bits */
-	char	alg_key[0];
+	char		alg_key[0];
 };
 
 struct xfrm_stats {

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

end of thread, other threads:[~2008-01-13  5:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-12 17:29 [XFRM]: alg_key_len should be unsigned to avoid integer divides Eric Dumazet
2008-01-13  5:32 ` 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).