aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-09-22 22:16:20 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-22 22:16:20 -0400
commitf11d32dfaa0753cfab7b2e5052923e8784a3c141 (patch)
treea624b87d9fee2f9673ca0d2c63b821c7918932b4 /drivers/isdn/hardware
parent4d5392cc4de3403d71b929f39f3bc659db029ad1 (diff)
mISDN: endian annotations for struct zt
Found two possible bugs where the z1 value was used directly without byteswapping. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/hardware')
-rw-r--r--drivers/isdn/hardware/mISDN/hfc_pci.h4
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c9
2 files changed, 6 insertions, 7 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfc_pci.h b/drivers/isdn/hardware/mISDN/hfc_pci.h
index fd2c9be6d849..5783d22a18fe 100644
--- a/drivers/isdn/hardware/mISDN/hfc_pci.h
+++ b/drivers/isdn/hardware/mISDN/hfc_pci.h
@@ -183,8 +183,8 @@
183#define D_FREG_MASK 0xF 183#define D_FREG_MASK 0xF
184 184
185struct zt { 185struct zt {
186 unsigned short z1; /* Z1 pointer 16 Bit */ 186 __le16 z1; /* Z1 pointer 16 Bit */
187 unsigned short z2; /* Z2 pointer 16 Bit */ 187 __le16 z2; /* Z2 pointer 16 Bit */
188}; 188};
189 189
190struct dfifo { 190struct dfifo {
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index 9cf5edbb1a9b..9f808ecc6898 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -366,8 +366,7 @@ static void hfcpci_clear_fifo_tx(struct hfc_pci *hc, int fifo)
366 bzt->f2 = MAX_B_FRAMES; 366 bzt->f2 = MAX_B_FRAMES;
367 bzt->f1 = bzt->f2; /* init F pointers to remain constant */ 367 bzt->f1 = bzt->f2; /* init F pointers to remain constant */
368 bzt->za[MAX_B_FRAMES].z1 = cpu_to_le16(B_FIFO_SIZE + B_SUB_VAL - 1); 368 bzt->za[MAX_B_FRAMES].z1 = cpu_to_le16(B_FIFO_SIZE + B_SUB_VAL - 1);
369 bzt->za[MAX_B_FRAMES].z2 = cpu_to_le16( 369 bzt->za[MAX_B_FRAMES].z2 = cpu_to_le16(B_FIFO_SIZE + B_SUB_VAL - 2);
370 le16_to_cpu(bzt->za[MAX_B_FRAMES].z1 - 1));
371 if (fifo_state) 370 if (fifo_state)
372 hc->hw.fifo_en |= fifo_state; 371 hc->hw.fifo_en |= fifo_state;
373 Write_hfc(hc, HFCPCI_FIFO_EN, hc->hw.fifo_en); 372 Write_hfc(hc, HFCPCI_FIFO_EN, hc->hw.fifo_en);
@@ -482,7 +481,7 @@ receive_dmsg(struct hfc_pci *hc)
482 df->f2 = ((df->f2 + 1) & MAX_D_FRAMES) | 481 df->f2 = ((df->f2 + 1) & MAX_D_FRAMES) |
483 (MAX_D_FRAMES + 1); /* next buffer */ 482 (MAX_D_FRAMES + 1); /* next buffer */
484 df->za[df->f2 & D_FREG_MASK].z2 = 483 df->za[df->f2 & D_FREG_MASK].z2 =
485 cpu_to_le16((zp->z2 + rcnt) & (D_FIFO_SIZE - 1)); 484 cpu_to_le16((le16_to_cpu(zp->z2) + rcnt) & (D_FIFO_SIZE - 1));
486 } else { 485 } else {
487 dch->rx_skb = mI_alloc_skb(rcnt - 3, GFP_ATOMIC); 486 dch->rx_skb = mI_alloc_skb(rcnt - 3, GFP_ATOMIC);
488 if (!dch->rx_skb) { 487 if (!dch->rx_skb) {
@@ -526,7 +525,7 @@ receive_dmsg(struct hfc_pci *hc)
526int 525int
527hfcpci_empty_fifo_trans(struct bchannel *bch, struct bzfifo *bz, u_char *bdata) 526hfcpci_empty_fifo_trans(struct bchannel *bch, struct bzfifo *bz, u_char *bdata)
528{ 527{
529 unsigned short *z1r, *z2r; 528 __le16 *z1r, *z2r;
530 int new_z2, fcnt, maxlen; 529 int new_z2, fcnt, maxlen;
531 u_char *ptr, *ptr1; 530 u_char *ptr, *ptr1;
532 531
@@ -724,7 +723,7 @@ hfcpci_fill_fifo(struct bchannel *bch)
724 struct bzfifo *bz; 723 struct bzfifo *bz;
725 u_char *bdata; 724 u_char *bdata;
726 u_char new_f1, *src, *dst; 725 u_char new_f1, *src, *dst;
727 unsigned short *z1t, *z2t; 726 __le16 *z1t, *z2t;
728 727
729 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO)) 728 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO))
730 printk(KERN_DEBUG "%s\n", __func__); 729 printk(KERN_DEBUG "%s\n", __func__);