Loading drivers/usb/net/gl620a.c +12 −14 Original line number Original line Diff line number Diff line Loading @@ -70,12 +70,12 @@ (((GL_MAX_PACKET_LEN + 4) * GL_MAX_TRANSMIT_PACKETS) + 4) (((GL_MAX_PACKET_LEN + 4) * GL_MAX_TRANSMIT_PACKETS) + 4) struct gl_packet { struct gl_packet { u32 packet_length; __le32 packet_length; char packet_data [1]; char packet_data [1]; }; }; struct gl_header { struct gl_header { u32 packet_count; __le32 packet_count; struct gl_packet packets; struct gl_packet packets; }; }; Loading @@ -85,15 +85,14 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) struct gl_packet *packet; struct gl_packet *packet; struct sk_buff *gl_skb; struct sk_buff *gl_skb; u32 size; u32 size; u32 count; header = (struct gl_header *) skb->data; header = (struct gl_header *) skb->data; // get the packet count of the received skb // get the packet count of the received skb le32_to_cpus(&header->packet_count); count = le32_to_cpu(header->packet_count); if ((header->packet_count > GL_MAX_TRANSMIT_PACKETS) if (count > GL_MAX_TRANSMIT_PACKETS) { || (header->packet_count < 0)) { dbg("genelink: invalid received packet count %u", count); dbg("genelink: invalid received packet count %d", header->packet_count); return 0; return 0; } } Loading @@ -103,7 +102,7 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) // decrement the length for the packet count size 4 bytes // decrement the length for the packet count size 4 bytes skb_pull(skb, 4); skb_pull(skb, 4); while (header->packet_count > 1) { while (count > 1) { // get the packet length // get the packet length size = le32_to_cpu(packet->packet_length); size = le32_to_cpu(packet->packet_length); Loading @@ -124,9 +123,8 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) } } // advance to the next packet // advance to the next packet packet = (struct gl_packet *) packet = (struct gl_packet *)&packet->packet_data[size]; &packet->packet_data [size]; count--; header->packet_count--; // shift the data pointer to the next gl_packet // shift the data pointer to the next gl_packet skb_pull(skb, size + 4); skb_pull(skb, size + 4); Loading @@ -149,8 +147,8 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) int length = skb->len; int length = skb->len; int headroom = skb_headroom(skb); int headroom = skb_headroom(skb); int tailroom = skb_tailroom(skb); int tailroom = skb_tailroom(skb); u32 *packet_count; __le32 *packet_count; u32 *packet_len; __le32 *packet_len; // FIXME: magic numbers, bleech // FIXME: magic numbers, bleech padlen = ((skb->len + (4 + 4*1)) % 64) ? 0 : 1; padlen = ((skb->len + (4 + 4*1)) % 64) ? 0 : 1; Loading @@ -172,7 +170,7 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) } } // attach the packet count to the header // attach the packet count to the header packet_count = (u32 *) skb_push(skb, (4 + 4*1)); packet_count = (__le32 *) skb_push(skb, (4 + 4*1)); packet_len = packet_count + 1; packet_len = packet_count + 1; *packet_count = cpu_to_le32(1); *packet_count = cpu_to_le32(1); Loading drivers/usb/serial/cp2101.c +4 −4 Original line number Original line Diff line number Diff line Loading @@ -170,13 +170,13 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request, unsigned int *data, int size) unsigned int *data, int size) { { struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial; u32 *buf; __le32 *buf; int result, i, length; int result, i, length; /* Number of integers required to contain the array */ /* Number of integers required to contain the array */ length = (((size - 1) | 3) + 1)/4; length = (((size - 1) | 3) + 1)/4; buf = kcalloc(length, sizeof(u32), GFP_KERNEL); buf = kcalloc(length, sizeof(__le32), GFP_KERNEL); if (!buf) { if (!buf) { dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); return -ENOMEM; return -ENOMEM; Loading Loading @@ -216,13 +216,13 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request, unsigned int *data, int size) unsigned int *data, int size) { { struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial; u32 *buf; __le32 *buf; int result, i, length; int result, i, length; /* Number of integers required to contain the array */ /* Number of integers required to contain the array */ length = (((size - 1) | 3) + 1)/4; length = (((size - 1) | 3) + 1)/4; buf = kmalloc(length * sizeof(u32), GFP_KERNEL); buf = kmalloc(length * sizeof(__le32), GFP_KERNEL); if (!buf) { if (!buf) { dev_err(&port->dev, "%s - out of memory.\n", dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); __FUNCTION__); Loading Loading
drivers/usb/net/gl620a.c +12 −14 Original line number Original line Diff line number Diff line Loading @@ -70,12 +70,12 @@ (((GL_MAX_PACKET_LEN + 4) * GL_MAX_TRANSMIT_PACKETS) + 4) (((GL_MAX_PACKET_LEN + 4) * GL_MAX_TRANSMIT_PACKETS) + 4) struct gl_packet { struct gl_packet { u32 packet_length; __le32 packet_length; char packet_data [1]; char packet_data [1]; }; }; struct gl_header { struct gl_header { u32 packet_count; __le32 packet_count; struct gl_packet packets; struct gl_packet packets; }; }; Loading @@ -85,15 +85,14 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) struct gl_packet *packet; struct gl_packet *packet; struct sk_buff *gl_skb; struct sk_buff *gl_skb; u32 size; u32 size; u32 count; header = (struct gl_header *) skb->data; header = (struct gl_header *) skb->data; // get the packet count of the received skb // get the packet count of the received skb le32_to_cpus(&header->packet_count); count = le32_to_cpu(header->packet_count); if ((header->packet_count > GL_MAX_TRANSMIT_PACKETS) if (count > GL_MAX_TRANSMIT_PACKETS) { || (header->packet_count < 0)) { dbg("genelink: invalid received packet count %u", count); dbg("genelink: invalid received packet count %d", header->packet_count); return 0; return 0; } } Loading @@ -103,7 +102,7 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) // decrement the length for the packet count size 4 bytes // decrement the length for the packet count size 4 bytes skb_pull(skb, 4); skb_pull(skb, 4); while (header->packet_count > 1) { while (count > 1) { // get the packet length // get the packet length size = le32_to_cpu(packet->packet_length); size = le32_to_cpu(packet->packet_length); Loading @@ -124,9 +123,8 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) } } // advance to the next packet // advance to the next packet packet = (struct gl_packet *) packet = (struct gl_packet *)&packet->packet_data[size]; &packet->packet_data [size]; count--; header->packet_count--; // shift the data pointer to the next gl_packet // shift the data pointer to the next gl_packet skb_pull(skb, size + 4); skb_pull(skb, size + 4); Loading @@ -149,8 +147,8 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) int length = skb->len; int length = skb->len; int headroom = skb_headroom(skb); int headroom = skb_headroom(skb); int tailroom = skb_tailroom(skb); int tailroom = skb_tailroom(skb); u32 *packet_count; __le32 *packet_count; u32 *packet_len; __le32 *packet_len; // FIXME: magic numbers, bleech // FIXME: magic numbers, bleech padlen = ((skb->len + (4 + 4*1)) % 64) ? 0 : 1; padlen = ((skb->len + (4 + 4*1)) % 64) ? 0 : 1; Loading @@ -172,7 +170,7 @@ genelink_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) } } // attach the packet count to the header // attach the packet count to the header packet_count = (u32 *) skb_push(skb, (4 + 4*1)); packet_count = (__le32 *) skb_push(skb, (4 + 4*1)); packet_len = packet_count + 1; packet_len = packet_count + 1; *packet_count = cpu_to_le32(1); *packet_count = cpu_to_le32(1); Loading
drivers/usb/serial/cp2101.c +4 −4 Original line number Original line Diff line number Diff line Loading @@ -170,13 +170,13 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request, unsigned int *data, int size) unsigned int *data, int size) { { struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial; u32 *buf; __le32 *buf; int result, i, length; int result, i, length; /* Number of integers required to contain the array */ /* Number of integers required to contain the array */ length = (((size - 1) | 3) + 1)/4; length = (((size - 1) | 3) + 1)/4; buf = kcalloc(length, sizeof(u32), GFP_KERNEL); buf = kcalloc(length, sizeof(__le32), GFP_KERNEL); if (!buf) { if (!buf) { dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); return -ENOMEM; return -ENOMEM; Loading Loading @@ -216,13 +216,13 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request, unsigned int *data, int size) unsigned int *data, int size) { { struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial; u32 *buf; __le32 *buf; int result, i, length; int result, i, length; /* Number of integers required to contain the array */ /* Number of integers required to contain the array */ length = (((size - 1) | 3) + 1)/4; length = (((size - 1) | 3) + 1)/4; buf = kmalloc(length * sizeof(u32), GFP_KERNEL); buf = kmalloc(length * sizeof(__le32), GFP_KERNEL); if (!buf) { if (!buf) { dev_err(&port->dev, "%s - out of memory.\n", dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); __FUNCTION__); Loading