From: Al Viro <viro@ftp.linux.org.uk>
To: Steven Whitehouse <swhiteho@redhat.com>
Cc: Patrick Caulfield <patrick@tykepenguin.com>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [DECNET] Endian bug fixes
Date: Mon, 6 Nov 2006 10:34:50 +0000 [thread overview]
Message-ID: <20061106103449.GG29920@ftp.linux.org.uk> (raw)
In-Reply-To: <20061106103243.GF29920@ftp.linux.org.uk>
On Mon, Nov 06, 2006 at 10:32:43AM +0000, Al Viro wrote:
> On Mon, Nov 06, 2006 at 10:31:02AM +0000, Steven Whitehouse wrote:
> > + opt->opt_optl = dn_htons((__u16)*ptr++);
>
> Lose that cast; it's only confusing the things...
>
> > + memcpy(opt->opt_data, ptr, dn_ntohs(opt->opt_optl));
> > + skb_pull(skb, dn_ntohs(opt->opt_optl) + 1);
>
> ... and I'd actually do
>
> u16 len = *ptr++; /* yes, it's 8bit on the wire */
> opt->opt_optl = dn_htons(len);
> BUG_ON(len > 16); /* we've checked the contents earlier */
> memcpy(opt->opt_data, ptr, len);
> skb_pull(skb, len + 1);
BTW, why the hell do we keep ->opt_optl __le16 internally? If we ever
pass it to userland, fine, but let's convert to __le16 *then*...
next prev parent reply other threads:[~2006-11-06 10:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-06 10:31 [DECNET] Endian bug fixes Steven Whitehouse
2006-11-06 10:32 ` Al Viro
2006-11-06 10:34 ` Al Viro [this message]
2006-11-06 11:50 ` Steven Whitehouse
2006-11-06 11:50 ` Steven Whitehouse
2006-11-07 22:59 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061106103449.GG29920@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=patrick@tykepenguin.com \
--cc=swhiteho@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).