From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754719AbdFWXhg (ORCPT ); Fri, 23 Jun 2017 19:37:36 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:1728 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754558AbdFWXhd (ORCPT ); Fri, 23 Jun 2017 19:37:33 -0400 X-IronPort-AV: E=Sophos;i="5.39,380,1493676000"; d="scan'208";a="229441102" Date: Fri, 23 Jun 2017 19:37:28 -0400 (EDT) From: Julia Lawall X-X-Sender: jll@hadrien To: Frans Klaver cc: Joe Perches , Greg Kroah-Hartman , kernel-janitors , Guenter Roeck , Yueyao Zhu , Rui Miguel Silva , Guru Das Srinagesh , Javier Martinez Canillas , devel@driverdev.osuosl.org, "linux-kernel@vger.kernel.org" Subject: Re: endian bitshift defects [ was: staging: fusb302: don't bitshift __le16 type ] In-Reply-To: Message-ID: References: <20170616174556.2358-1-fransklaver@gmail.com> <1497653077.10546.23.camel@perches.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. thanks, julia