Commit d0a0bbe7 authored by Tong Zhang's avatar Tong Zhang Committed by David S. Miller

atm: idt77252: fix build broken on amd64

idt77252 is broken and wont load on amd64 systems
  modprobe idt77252 shows the following

    idt77252_init: skb->cb is too small (48 < 56)

  Add packed attribute to struct idt77252_skb_prv and struct atm_skb_data
  so that the total size can be <= sizeof(skb->cb)
  Also convert runtime size check to buildtime size check in
  idt77252_init()
Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 57baf8cc
...@@ -3743,16 +3743,7 @@ static int __init idt77252_init(void) ...@@ -3743,16 +3743,7 @@ static int __init idt77252_init(void)
struct sk_buff *skb; struct sk_buff *skb;
printk("%s: at %p\n", __func__, idt77252_init); printk("%s: at %p\n", __func__, idt77252_init);
BUILD_BUG_ON(sizeof(skb->cb) < sizeof(struct idt77252_skb_prv) + sizeof(struct atm_skb_data));
if (sizeof(skb->cb) < sizeof(struct atm_skb_data) +
sizeof(struct idt77252_skb_prv)) {
printk(KERN_ERR "%s: skb->cb is too small (%lu < %lu)\n",
__func__, (unsigned long) sizeof(skb->cb),
(unsigned long) sizeof(struct atm_skb_data) +
sizeof(struct idt77252_skb_prv));
return -EIO;
}
return pci_register_driver(&idt77252_driver); return pci_register_driver(&idt77252_driver);
} }
......
...@@ -789,7 +789,7 @@ struct idt77252_skb_prv { ...@@ -789,7 +789,7 @@ struct idt77252_skb_prv {
struct scqe tbd; /* Transmit Buffer Descriptor */ struct scqe tbd; /* Transmit Buffer Descriptor */
dma_addr_t paddr; /* DMA handle */ dma_addr_t paddr; /* DMA handle */
u32 pool; /* sb_pool handle */ u32 pool; /* sb_pool handle */
}; } __packed;
#define IDT77252_PRV_TBD(skb) \ #define IDT77252_PRV_TBD(skb) \
(((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->tbd) (((struct idt77252_skb_prv *)(ATM_SKB(skb)+1))->tbd)
......
...@@ -207,7 +207,7 @@ struct atm_skb_data { ...@@ -207,7 +207,7 @@ struct atm_skb_data {
struct atm_vcc *vcc; /* ATM VCC */ struct atm_vcc *vcc; /* ATM VCC */
unsigned long atm_options; /* ATM layer options */ unsigned long atm_options; /* ATM layer options */
unsigned int acct_truesize; /* truesize accounted to vcc */ unsigned int acct_truesize; /* truesize accounted to vcc */
}; } __packed;
#define VCC_HTABLE_SIZE 32 #define VCC_HTABLE_SIZE 32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment