lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39e6f6c70705160935q66109a3ci414374544d99c78f@mail.gmail.com>
Date:	Wed, 16 May 2007 13:35:45 -0300
From:	"Arnaldo Carvalho de Melo" <acme@...stprotocols.net>
To:	"Urs Thuermann" <urs@...ogud.escape.de>
Cc:	netdev@...r.kernel.org, "Thomas Gleixner" <tglx@...utronix.de>,
	"Oliver Hartkopp" <oliver.hartkopp@...kswagen.de>,
	"Urs Thuermann" <urs.thuermann@...kswagen.de>
Subject: Re: [patch 2/7] CAN: Add PF_CAN core module

On 5/16/07, Urs Thuermann <urs@...ogud.escape.de> wrote:
> This patch adds the CAN core functionality but no protocols or drivers.
> No protocol implementations are included here.  They come as separate
> patches.  Protocol numbers are already in include/linux/can.h.
>
> Signed-Off-By: Oliver Hartkopp <oliver.hartkopp@...kswagen.de>
> Signed-Off-By: Urs Thuermann <urs.thuermann@...kswagen.de>

<SNIP>

> +
> +/**
> + * struct sockaddr_can - the sockaddr structure for CAN sockets
> + * @can_family:  address family number AF_CAN.
> + * @can_ifindex: CAN network interface index.
> + * @can_addr:    transport protocol specific address, mostly CAN IDs.
> + */
> +struct sockaddr_can {
> +       sa_family_t can_family;
> +       int         can_ifindex;
> +       union {
> +               struct { canid_t rx_id, tx_id; } tp16;
> +               struct { canid_t rx_id, tx_id; } tp20;
> +               struct { canid_t rx_id, tx_id; } mcnet;
> +               struct { canid_t rx_id, tx_id; } isotp;
> +               struct { int     lcu,   type;  } bap;
> +       } can_addr;
> +};

Can can_ifindex be turned into a unsigned short? That way we would
have it nicely packed, avoiding this hole:

[acme@...o examples]$ pahole can
/* <1c2> /home/acme/git/pahole/examples/can.c:5 */
struct sockaddr_can {
	sa_family_t                can_family;    /*     0     2 */

	/* XXX 2 bytes hole, try to pack */

	int                        can_ifindex;   /*  4  4 */
	union {
		struct {
			canid_t    rx_id;         /*  8  4 */
			canid_t    tx_id;         /* 12  4 */
		} tp16;                           /*     8 */
		struct {
			canid_t    rx_id;         /*  8  4 */
			canid_t    tx_id;         /* 12  4 */
		} tp20;                           /*     8 */
		struct {
			canid_t    rx_id;         /*  8  4 */
			canid_t    tx_id;         /* 12  4 */
		} mcnet;                          /*     8 */
		struct {
			canid_t    rx_id;         /*  8  4 */
			canid_t    tx_id;         /* 12  4 */
		} isotp;                          /*     8 */
		struct {
			int        lcu;           /*  8  4 */
			int        type;          /* 12  4 */
		} bap;                            /*     8 */
	} can_addr;                               /*  8  8 */
}; /* size: 16, cachelines: 1 */
   /* sum members: 14, holes: 1, sum holes: 2 */
   /* last cacheline: 16 bytes */
   /* definitions: 1 */

- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ