Author: bencollins
Date: 2002-11-04 18:16:23 -0500 (Mon, 04 Nov 2002)
New Revision: 658
Modified:
trunk/ieee1394_transactions.c
Log:
Fix logic in hpsb_make{read,write}_packet. Patch from Manfred Weihs.
Modified: trunk/ieee1394_transactions.c
==============================================================================
--- trunk/ieee1394_transactions.c (original)
+++ trunk/ieee1394_transactions.c 2002-11-04 18:16:23.000000000 -0500
@@ -250,10 +250,7 @@
if (length == 0)
return NULL;
- if (length % 4)
- length += 4 - (length % 4);
-
- packet = alloc_hpsb_packet(length);
+ packet = alloc_hpsb_packet(length + (length % 4 ? 4 - (length % 4) : 0));
if (!packet)
return NULL;
@@ -281,14 +278,13 @@
if (length == 0)
return NULL;
- if (length % 4)
- length += 4 - (length % 4);
-
- packet = alloc_hpsb_packet(length);
+ packet = alloc_hpsb_packet(length + (length % 4 ? 4 - (length % 4) : 0));
if (!packet)
return NULL;
- packet->data[length >> 2] = 0;
+ if (length % 4) { /* zero padding bytes */
+ packet->data[length >> 2] = 0;
+ }
packet->host = host;
packet->node_id = node;
|