From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbbKZVCc (ORCPT ); Thu, 26 Nov 2015 16:02:32 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:50267 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850AbbKZVC3 (ORCPT ); Thu, 26 Nov 2015 16:02:29 -0500 Date: Thu, 26 Nov 2015 21:02:24 +0000 From: Al Viro To: Joe Perches Cc: "Theodore Ts'o" , Julia Lawall , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fix an endianness bug in ext4_encrypted_follow_link() Message-ID: <20151126210223.GV22011@ZenIV.linux.org.uk> References: <20151126152728.GT22011@ZenIV.linux.org.uk> <1448566837.18647.16.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1448566837.18647.16.camel@perches.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 26, 2015 at 11:40:37AM -0800, Joe Perches wrote: > (cc'ing Julia Lawall) > > On Thu, 2015-11-26 at 15:27 +0000, Al Viro wrote: > > applying le32_to_cpu() to 16bit value is a bad idea... > > Julia, perhaps you or your crew could produce a coccinelle test > for this class of error? What's wrong with something like make C=2 CF=-D__CHECK_ENDIAN__ fs/ext4/ ? Worked just fine, TYVM - CHECK fs/ext4/symlink.c fs/ext4/symlink.c:55:21: warning: cast to restricted __le32 fs/ext4/symlink.c:55:21: warning: cast from restricted __le16 points to exact location... Sure, you need to figure out _how_ it's broken (e.g. with something like struct foo { __le32 a; __le16 b; } *p; le32_to_cpu(p->b) might have been misspelled le16_to_cpu(p->b) as well as le32_to_cpu(p->a)) - no way to tell one from another without actually reading and understanding the code in question. But that doesn't depend upon the tool used to locate the damn thing and sparse does locate them...