From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bcsGW-0003R3-PI for mharc-grub-devel@gnu.org; Thu, 25 Aug 2016 06:52:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcsGU-0003Qq-Hq for grub-devel@gnu.org; Thu, 25 Aug 2016 06:52:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcsGS-0001Nw-JL for grub-devel@gnu.org; Thu, 25 Aug 2016 06:52:05 -0400 Received: from mail-ua0-x229.google.com ([2607:f8b0:400c:c08::229]:35260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcsGS-0001Nb-Cf for grub-devel@gnu.org; Thu, 25 Aug 2016 06:52:04 -0400 Received: by mail-ua0-x229.google.com with SMTP id n59so76712550uan.2 for ; Thu, 25 Aug 2016 03:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=t1TleTndVjhxBoJGqq3SKC9DI5Iqf4/q2jN1QiPbIeY=; b=Smuqd2T4ldRsohjz6MAdDj2xd2XZK60s+83UwxDtBo8huvCnuL7IsqpsthT39KarGQ 6p7rDRbGw4u9vm/PBujr29WlYu+ByJVeZxPDGgmJINiHHWt4E2Y6gHWIvsXYCzaksh1/ X+sXRgvxG71Y+AgNsDm5d6CLH1MU6TeBP8k563c/OH47y65lyYHviwgW4Fq9CF+S/XHm LI60pmj73/GWt9Per5gGyQv4va5w+irQDuNtptEiS58ZK8/Hi4woyxADPN6Q0LHr+MrT JuzNUp2C1HJrDct4wAi3ZVvbUuFUC6bvRElER1nswEiaeoaCj3HOtyearW6m7Vk1EHvo VjOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=t1TleTndVjhxBoJGqq3SKC9DI5Iqf4/q2jN1QiPbIeY=; b=kyveU/4hRmpQnsuIYx1DRrxKQwPu1fLlHDjjD2yli8e3hE31asu5p/HqX4jGcLpB/R EHGoqalKXI+0CMVjNx3TajhKzjah+hmSTJ3EpL3V6iA15lu4dFgc1zLX5n8V1qhY5uZ0 zQO+tr7gOviYUJptjE4ZT18GVyjaoGDFe0MeVikCENYCJZ5zPArWBR/lFnSRO9oPBFV9 Y80145v+B1Hfb4GuAbw97p1mDazLMIUZqpAw94CurMYmCau+sETzTn0kziLvOr2Rn/mA /UJl+afhw1gEg4m573C4XN7Dkgka9WI7FSzFYUBPUS1pfi7Hrqmik+dblI9tNm85k9DM 7MdA== X-Gm-Message-State: AE9vXwOo9/fEn09GPMmmPP7wD1y9oroXcgKZqgnLbcyxoF86P8DDY7c+OtqR7db6MqSVVNhZ+ptYS4YaRlGu8psi X-Received: by 10.176.69.145 with SMTP id u17mr4554664uau.145.1472122322628; Thu, 25 Aug 2016 03:52:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.31.210 with HTTP; Thu, 25 Aug 2016 03:52:02 -0700 (PDT) In-Reply-To: References: <1472045782-11346-1-git-send-email-carlo@caione.org> <1472045782-11346-2-git-send-email-carlo@caione.org> From: Carlo Caione Date: Thu, 25 Aug 2016 12:52:02 +0200 Message-ID: Subject: Re: [PATCH] FAT/exFAT: Fix wrong size detection for files > 4GB To: The development of GNU GRUB Cc: arvidjaar@gmail.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c08::229 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2016 10:52:07 -0000 On Wed, Aug 24, 2016 at 9:37 PM, Andrei Borzenkov wro= te: > 24.08.2016 16:36, Carlo Caione =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> From: Carlo Caione >> >> For exFAT the file size can be > 4GB. The 'grub_fat_data' is still >> marking the 'file_size' as grub_ssize_t that is always 32bit when >> compiling for i386-pc also when using exFAT. >> >> This is causing a problem when trying to open in loopback a > 4GB file >> from an exFAT partition. >> >> Fix this modifying the size of the 'file_size' according to the >> MODE_EXFAT define. >> >> Signed-off-by: Carlo Caione >> --- >> grub-core/fs/fat.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c >> index 79fe864..d5212c2 100644 >> --- a/grub-core/fs/fat.c >> +++ b/grub-core/fs/fat.c >> @@ -183,7 +183,11 @@ struct grub_fat_data >> grub_uint32_t num_clusters; >> >> grub_uint8_t attr; >> - grub_ssize_t file_size; >> +#ifndef MODE_EXFAT >> + grub_uint32_t file_size; >> +#else >> + grub_uint64_t file_size; >> +#endif >> grub_uint32_t file_cluster; >> grub_uint32_t cur_cluster_num; >> grub_uint32_t cur_cluster; >> > > Looks correct except I'd use conditon "ifdef MODE_EXFAT", negative > condition looks strange in such cases. This pattern is literally used 5 lines above and all over the place in fat.= c It would look strange otherwise. --=20 Carlo Caione | +39.340.80.30.096 | Endless