From patchwork Fri Nov 14 17:33:49 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Harrison X-Patchwork-Id: 8782 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id CFC3FDDDE6 for ; Sat, 15 Nov 2008 04:40:31 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752910AbYKNRk0 (ORCPT ); Fri, 14 Nov 2008 12:40:26 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752686AbYKNRkZ (ORCPT ); Fri, 14 Nov 2008 12:40:25 -0500 Received: from wf-out-1314.google.com ([209.85.200.174]:14238 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174AbYKNRkY (ORCPT ); Fri, 14 Nov 2008 12:40:24 -0500 Received: by wf-out-1314.google.com with SMTP id 27so1516863wfd.4 for ; Fri, 14 Nov 2008 09:40:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=pUqVXLghRLtdetPsrx0KHVTQWysu5pGjPpME5r/J9pY=; b=FoOpxrlwcDni1BdTCAys0+W8daXQ1M0ZcajhiSzDglbLPi04loX9WbSbTHOiKDyKRx r+3B/t5xYEnvsgJa6JW6m8KGZqvzrQBKRv72uRMVGrIS3Qrc1LY4bghMzE0WRxgS5Dl4 LwakbNKSxn1mJv0fbfJ7MokcIiIt0Ou9NZmsw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=KI7x8N9QH86mQ3ZCs2hKtt5T1r1Zqv9Coua0m5VsP/GPr+iAKksRVva4ixVyHLy2cV gvCZaTV9LEjZTBS9hek3BA9GBFmSOPEWgsVeBDT+xKHu4K7yWa2fnVB3F0ekMLfthkSS tZfOKhAec95JIGVzJQvb6tiiQY2gNbsUknNa0= Received: by 10.142.217.17 with SMTP id p17mr508290wfg.275.1226684032496; Fri, 14 Nov 2008 09:33:52 -0800 (PST) Received: from ?192.168.101.80? ([24.85.64.172]) by mx.google.com with ESMTPS id 29sm737737wfg.26.2008.11.14.09.33.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 14 Nov 2008 09:33:52 -0800 (PST) Subject: [PATCH] isdn: bugfix in isdn_net_ciscohdlck_slarp_send_reply, trivial sparse fixes From: Harvey Harrison To: David Miller Cc: Al Viro , Karsten Keil , linux-netdev Date: Fri, 14 Nov 2008 09:33:49 -0800 Message-Id: <1226684029.5483.12.camel@brick> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org commit a144ea4b7a13087081ab5402fa9ad0bcfd249e67 [IPV4]: annotate struct in_ifaddr Missed the extra byteswap because the previous isdn inline helpers hid the extra htonl inside put_u32. This was causing an extra byteswap on little-endian arches. While here, do the trivial annotation of the struct ip_ports and change the remaining casts to __be16 where applicable. Signed-off-by: Harvey Harrison --- Dave, the yesterday's patch was a zero-change patch that exposed this bug, this patch changes behavior in the above-referenced function. drivers/isdn/i4l/isdn_net.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 8fff0bd..8e51bfb 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c @@ -865,8 +865,8 @@ isdn_net_hangup(struct net_device *d) } typedef struct { - unsigned short source; - unsigned short dest; + __be16 source; + __be16 dest; } ip_ports; static void @@ -1355,7 +1355,7 @@ isdn_net_get_stats(struct net_device *dev) * This is normal practice and works for any 'now in use' protocol. */ -static unsigned short +static __be16 isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev) { struct ethhdr *eth; @@ -1637,8 +1637,8 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) /* slarp reply, send own ip/netmask; if values are nonsense remote * should think we are unable to provide it with an address via SLARP */ *(__be32 *)(p + 4) = cpu_to_be32(CISCO_SLARP_REPLY); - *(__be32 *)(p + 8) = cpu_to_be32(addr); // address - *(__be32 *)(p + 12) = cpu_to_be32(mask); // netmask + *(__be32 *)(p + 8) = addr; // address + *(__be32 *)(p + 12) = mask; // netmask *(__be16 *)(p + 16) = cpu_to_be16(0); // unused p += 18; @@ -1817,7 +1817,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) /* IP with type field */ olp->huptimer = 0; lp->huptimer = 0; - skb->protocol = *(unsigned short *) &(skb->data[0]); + skb->protocol = *(__be16 *)&(skb->data[0]); skb_pull(skb, 2); if (*(unsigned short *) skb->data == 0xFFFF) skb->protocol = htons(ETH_P_802_3); @@ -1899,12 +1899,12 @@ static int isdn_net_header(struct sk_buff *skb, struct net_device *dev, break; case ISDN_NET_ENCAP_IPTYP: /* ethernet type field */ - *((ushort *) skb_push(skb, 2)) = htons(type); + *((__be16 *)skb_push(skb, 2)) = htons(type); len = 2; break; case ISDN_NET_ENCAP_UIHDLC: /* HDLC with UI-Frames (for ispa with -h1 option) */ - *((ushort *) skb_push(skb, 2)) = htons(0x0103); + *((__be16 *)skb_push(skb, 2)) = htons(0x0103); len = 2; break; case ISDN_NET_ENCAP_CISCOHDLC: