From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753312AbbKZTko (ORCPT ); Thu, 26 Nov 2015 14:40:44 -0500 Received: from smtprelay0018.hostedemail.com ([216.40.44.18]:48683 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752275AbbKZTkk (ORCPT ); Thu, 26 Nov 2015 14:40:40 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1539:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3866:3867:3871:3873:4321:5007:6261:10004:10400:10848:11026:11658:11914:12043:12114:12438:12517:12519:12555:12740:13069:13311:13357:14096:14097:14659:21080:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: hand28_7a0dce272e420 X-Filterd-Recvd-Size: 1632 Message-ID: <1448566837.18647.16.camel@perches.com> Subject: Re: [PATCH] fix an endianness bug in ext4_encrypted_follow_link() From: Joe Perches To: Al Viro , "Theodore Ts'o" , Julia Lawall Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 26 Nov 2015 11:40:37 -0800 In-Reply-To: <20151126152728.GT22011@ZenIV.linux.org.uk> References: <20151126152728.GT22011@ZenIV.linux.org.uk> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.16.5-1ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (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? > diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c > index abe2401..e8e7af6 100644 > --- a/fs/ext4/symlink.c > +++ b/fs/ext4/symlink.c > @@ -52,7 +52,7 @@ static const char *ext4_encrypted_follow_link(struct dentry *dentry, void **cook > /* Symlink is encrypted */ > sd = (struct ext4_encrypted_symlink_data *)caddr; > cstr.name = sd->encrypted_path; > - cstr.len = le32_to_cpu(sd->len); > + cstr.len = le16_to_cpu(sd->len); > if ((cstr.len + > sizeof(struct ext4_encrypted_symlink_data) - 1) > > max_size) {