Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1674572

Re: endian bitshift defects [ was: staging: fusb302: don't bitshift __le16 type ]

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject Re: endian bitshift defects [ was: staging: fusb302: don't bitshift __le16 type ]
Date 2017-06-26 11:50 +0200
Message-ID <tWyOB-EC-5@gated-at.bofh.it> (permalink)
References <tT3nX-3dR-13@gated-at.bofh.it> <tT8dX-6uY-3@gated-at.bofh.it> <tVFp8-83f-15@gated-at.bofh.it> <tVGlc-9V-11@gated-at.bofh.it> <tWxfQ-8gX-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Mon, 26 Jun 2017, Frans Klaver wrote:

> On Sat, Jun 24, 2017 at 1:37 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >
> >
> > On Sat, 24 Jun 2017, Frans Klaver wrote:
> >
> >> Hm. For some reason the great mail filtering scheme decided to push
> >> this past my inbox :-/
> >>
> >> On Sat, Jun 17, 2017 at 12:44 AM, Joe Perches <joe@perches.com> wrote:
> >> > On Fri, 2017-06-16 at 19:45 +0200, Frans Klaver wrote:
> >> >> The header field in struct pd_message is declared as an __le16 type. The
> >> >> data in the message is supposed to be little endian. This means we don't
> >> >> have to go and shift the individual bytes into position when we're
> >> >> filling the buffer, we can just copy the contents right away. As an
> >> >> added benefit we don't get fishy results on big endian systems anymore.
> >> >
> >> > Thanks for pointing this out.
> >> >
> >> > There are several instances of this class of error.
> >>
> >> There are other smells around __(le|be) types that show up in staging
> >> that might be worth checking in the rest of the kernel as well. e.g.
> >> converting to cpu and storing it back into itself (possibly with its
> >> bytes reversed), direct assignments without conversion and what else
> >> you might have. sparse obviously already flags anything fishy going on
> >> with these types, but cannot distinguish between the classes of
> >> errors. I'll need to acquaint myself with spatch a bit more to be able
> >> to track that down.
> >
> > If you have concrete code examples, even fake ones, illustrating a class
> > of problem, then that would be great.
>
> I'll see if I can produce some somewhere this week.

Thanks.

julia

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: endian bitshift defects [ was: staging: fusb302: don't bitshift  __le16 type ] Frans Klaver <fransklaver@gmail.com> - 2017-06-24 00:40 +0200
  Re: endian bitshift defects [ was: staging: fusb302: don't bitshift  __le16 type ] Julia Lawall <julia.lawall@lip6.fr> - 2017-06-24 01:40 +0200
    Re: endian bitshift defects [ was: staging: fusb302: don't bitshift  __le16 type ] Frans Klaver <fransklaver@gmail.com> - 2017-06-26 10:10 +0200
      Re: endian bitshift defects [ was: staging: fusb302: don't bitshift  __le16 type ] Julia Lawall <julia.lawall@lip6.fr> - 2017-06-26 11:50 +0200
    Re: endian bitshift defects [ was: staging: fusb302: don't bitshift  __le16 type ] Frans Klaver <fransklaver@gmail.com> - 2017-06-26 23:00 +0200
      Re: endian bitshift defects [ was: staging: fusb302: don't bitshift  __le16 type ] Julia Lawall <julia.lawall@lip6.fr> - 2017-06-26 23:10 +0200

csiph-web