From patchwork Sat Jan 18 11:31:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 312280 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A45D12C009F for ; Sat, 18 Jan 2014 22:31:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753804AbaARLbL (ORCPT ); Sat, 18 Jan 2014 06:31:11 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:42387 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751830AbaARLbH (ORCPT ); Sat, 18 Jan 2014 06:31:07 -0500 Received: by mail-pa0-f48.google.com with SMTP id kx10so3610456pab.21 for ; Sat, 18 Jan 2014 03:31:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=R8899b9c4kBWV2bvEJua3eQXtfAxwyzxgoYFznVpQDU=; b=mubz5f1xPN6VST/di90OfaBjgUanK/SaTz9GnkyJlC4NNkDmafvi+pOvO0lkDRm4a1 enMjKR1G7Rba3RcN1LvvrPeHrqBHSAihf6czzKozCn6m9C9YQ6fKYw29JTuwduG7W6Eg 2KiWTGKpQaztCHb3whDTbEFlOV3hj4J8YDFrwrxwUnUQbQxuKUe1rcFDcWMOQkx6oUz8 /VOnr5gHo5lt79l+SkFFzC33Le7OS2PpIx+AIGCz+A4iRfRB49mBl9MBJ+oSaVSe6nlT 2Gsw6841So380KZ84RqvCVr3Aib5IASJnF1XmEbW59ZjM36sAeRJ6uvHFOlMmz1GSkgm DdKg== X-Received: by 10.68.136.66 with SMTP id py2mr7583676pbb.112.1390044667269; Sat, 18 Jan 2014 03:31:07 -0800 (PST) Received: from [192.168.1.104] ([219.143.84.31]) by mx.google.com with ESMTPSA id si6sm40787081pab.19.2014.01.18.03.31.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 18 Jan 2014 03:31:06 -0800 (PST) Message-ID: <52DA65F4.5070501@gmail.com> Date: Sat, 18 Jan 2014 19:31:00 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: mareklindner@neomailbox.ch, sw@simonwunderlich.de, antonio@meshcoding.com CC: David Miller , b.a.t.m.a.n@lists.open-mesh.org, netdev , "linux-kernel@vger.kernel.org" , linux-metag@vger.kernel.org, James Hogan Subject: [PATCH linux-next] net: batman-adv: use "__packed __aligned(2)" for each structure instead of "__packed(2)" region Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Unfortunately, not all compilers assumes the structures within a pack region also need be packed (e.g. metag), so need add a pack explicitly to satisfy all compilers. The related error (under metag with allmodconfig): MODPOST 2952 modules ERROR: "__compiletime_assert_431" [net/batman-adv/batman-adv.ko] undefined! ERROR: "__compiletime_assert_432" [net/batman-adv/batman-adv.ko] undefined! ERROR: "__compiletime_assert_429" [net/batman-adv/batman-adv.ko] undefined! ERROR: "__compiletime_assert_428" [net/batman-adv/batman-adv.ko] undefined! ERROR: "__compiletime_assert_423" [net/batman-adv/batman-adv.ko] undefined! Signed-off-by: Chen Gang --- net/batman-adv/packet.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h index 0a381d1..9206b48 100644 --- a/net/batman-adv/packet.h +++ b/net/batman-adv/packet.h @@ -154,7 +154,6 @@ enum batadv_tvlv_type { BATADV_TVLV_ROAM = 0x05, }; -#pragma pack(2) /* the destination hardware field in the ARP frame is used to * transport the claim type and the group id */ @@ -162,8 +161,7 @@ struct batadv_bla_claim_dst { uint8_t magic[3]; /* FF:43:05 */ uint8_t type; /* bla_claimframe */ __be16 group; /* group id */ -}; -#pragma pack() +} __packed __aligned(2); /** * struct batadv_ogm_packet - ogm (routing protocol) packet @@ -281,7 +279,6 @@ struct batadv_icmp_packet_rr { * misalignment of the payload after the ethernet header. It may also lead to * leakage of information when the padding it not initialized before sending. */ -#pragma pack(2) /** * struct batadv_unicast_packet - unicast packet for network payload @@ -300,7 +297,7 @@ struct batadv_unicast_packet { /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ -}; +} __packed __aligned(2); /** * struct batadv_unicast_4addr_packet - extended unicast packet @@ -316,7 +313,7 @@ struct batadv_unicast_4addr_packet { /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ -}; +} __packed __aligned(2); /** * struct batadv_frag_packet - fragmented packet @@ -347,7 +344,7 @@ struct batadv_frag_packet { uint8_t orig[ETH_ALEN]; __be16 seqno; __be16 total_size; -}; +} __packed __aligned(2); /** * struct batadv_bcast_packet - broadcast packet for network payload @@ -368,7 +365,7 @@ struct batadv_bcast_packet { /* "4 bytes boundary + 2 bytes" long to make the payload after the * following ethernet header again 4 bytes boundary aligned */ -}; +} __packed __aligned(2); /** * struct batadv_coded_packet - network coded packet @@ -404,9 +401,8 @@ struct batadv_coded_packet { uint8_t second_orig_dest[ETH_ALEN]; __be32 second_crc; __be16 coded_len; -}; +} __packed __aligned(2); -#pragma pack() /** * struct batadv_unicast_tvlv - generic unicast packet with tvlv payload