Skip to content

Commit 5cd77c1

Browse files
Hans Wippeldavem330
authored andcommitted
s390/ctcm: improve endianness handling
Use endianness conversions for SKB protocol assignments and usage to avoid endianness warnings reported by sparse. No functional changes. Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6bee4e2 commit 5cd77c1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/s390/net/ctcm_fsms.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg)
12831283
p_header = (struct pdu *)
12841284
(skb_tail_pointer(ch->trans_skb) - skb->len);
12851285
p_header->pdu_flag = 0x00;
1286-
if (skb->protocol == ntohs(ETH_P_SNAP))
1286+
if (be16_to_cpu(skb->protocol) == ETH_P_SNAP)
12871287
p_header->pdu_flag |= 0x60;
12881288
else
12891289
p_header->pdu_flag |= 0x20;

drivers/s390/net/ctcm_main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb)
106106
priv->stats.rx_frame_errors++;
107107
return;
108108
}
109-
pskb->protocol = ntohs(header->type);
109+
pskb->protocol = cpu_to_be16(header->type);
110110
if ((header->length <= LL_HEADER_LENGTH) ||
111111
(len <= LL_HEADER_LENGTH)) {
112112
if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) {
@@ -125,7 +125,7 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb)
125125
header->length -= LL_HEADER_LENGTH;
126126
len -= LL_HEADER_LENGTH;
127127
if ((header->length > skb_tailroom(pskb)) ||
128-
(header->length > len)) {
128+
(header->length > len)) {
129129
if (!(ch->logflags & LOG_FLAG_OVERRUN)) {
130130
CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR,
131131
"%s(%s): Packet size %d (overrun)"
@@ -485,7 +485,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb)
485485
} else {
486486
atomic_inc(&skb->users);
487487
header.length = l;
488-
header.type = skb->protocol;
488+
header.type = be16_to_cpu(skb->protocol);
489489
header.unused = 0;
490490
memcpy(skb_push(skb, LL_HEADER_LENGTH), &header,
491491
LL_HEADER_LENGTH);
@@ -503,7 +503,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb)
503503
atomic_inc(&skb->users);
504504
ch->prof.txlen += skb->len;
505505
header.length = skb->len + LL_HEADER_LENGTH;
506-
header.type = skb->protocol;
506+
header.type = be16_to_cpu(skb->protocol);
507507
header.unused = 0;
508508
memcpy(skb_push(skb, LL_HEADER_LENGTH), &header, LL_HEADER_LENGTH);
509509
block_len = skb->len + 2;
@@ -690,7 +690,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb)
690690
p_header->pdu_offset = skb->len;
691691
p_header->pdu_proto = 0x01;
692692
p_header->pdu_flag = 0x00;
693-
if (skb->protocol == ntohs(ETH_P_SNAP)) {
693+
if (be16_to_cpu(skb->protocol) == ETH_P_SNAP) {
694694
p_header->pdu_flag |= PDU_FIRST | PDU_CNTL;
695695
} else {
696696
p_header->pdu_flag |= PDU_FIRST;
@@ -745,7 +745,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb)
745745
p_header->pdu_proto = 0x01;
746746
p_header->pdu_flag = 0x00;
747747
p_header->pdu_seq = 0;
748-
if (skb->protocol == ntohs(ETH_P_SNAP)) {
748+
if (be16_to_cpu(skb->protocol) == ETH_P_SNAP) {
749749
p_header->pdu_flag |= PDU_FIRST | PDU_CNTL;
750750
} else {
751751
p_header->pdu_flag |= PDU_FIRST;

0 commit comments

Comments
 (0)