From d8392af8409ee5acea4a1ed1db5f2dbb6bfa5895 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 13 Jun 2010 17:34:40 +0000 Subject: [PATCH] Apparently sparse ignores __attribute__((packed)) when applied to an enum while gcc honors this attribute. The result is that sizeof(struct fcoe_rcv_info) is 48 when the header include/scsi/fc_frame.h is compiled with gcc and that sizeof(struct fcoe_rcv_info) > 48 when the same header is compiled by sparse. As a result, compilation with sparse fails due to the BUILD_BUG_ON() statement in the function fcoe_dev_from_skb(), even when checking a vanilla Linux kernel with sparse. The patch below slightly modifies include/scsi/fc_frame.h such that gcc and sparse interpret this header in the same way. Note: it is fine to revert this patch once the behavior of gcc and sparse is again in sync. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1767 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/linux-patches/14-fc-frame-sparse-workaround | 13 +++++++++++++ fcst/linux-patches/series-2.6.33-rc8 | 1 + fcst/linux-patches/series-2.6.34 | 1 + 3 files changed, 15 insertions(+) create mode 100644 fcst/linux-patches/14-fc-frame-sparse-workaround diff --git a/fcst/linux-patches/14-fc-frame-sparse-workaround b/fcst/linux-patches/14-fc-frame-sparse-workaround new file mode 100644 index 000000000..7c9ea5881 --- /dev/null +++ b/fcst/linux-patches/14-fc-frame-sparse-workaround @@ -0,0 +1,13 @@ +--- a/include/scsi/fc_frame.h 2010-06-13 11:08:26.000000000 +0200 ++++ b/include/scsi/fc_frame.h 2010-06-13 11:08:53.000000000 +0200 +@@ -66,8 +66,8 @@ struct fcoe_rcv_info { + struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */ + u32 fr_crc; + u16 fr_max_payload; /* max FC payload */ +- enum fc_sof fr_sof; /* start of frame delimiter */ +- enum fc_eof fr_eof; /* end of frame delimiter */ ++ u8 fr_sof; /* start of frame delimiter */ ++ u8 fr_eof; /* end of frame delimiter */ + u8 fr_flags; /* flags - see below */ + u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */ + }; diff --git a/fcst/linux-patches/series-2.6.33-rc8 b/fcst/linux-patches/series-2.6.33-rc8 index b8b37331c..1d341c08c 100644 --- a/fcst/linux-patches/series-2.6.33-rc8 +++ b/fcst/linux-patches/series-2.6.33-rc8 @@ -12,3 +12,4 @@ 11-ptp-flogi-recv 12-ptp-npiv 13-ptp-acc +14-fc-frame-sparse-workaround diff --git a/fcst/linux-patches/series-2.6.34 b/fcst/linux-patches/series-2.6.34 index b8b37331c..1d341c08c 100644 --- a/fcst/linux-patches/series-2.6.34 +++ b/fcst/linux-patches/series-2.6.34 @@ -12,3 +12,4 @@ 11-ptp-flogi-recv 12-ptp-npiv 13-ptp-acc +14-fc-frame-sparse-workaround