From: Carlo Caione <carlo@endlessm.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: arvidjaar@gmail.com
Subject: Re: [PATCH] FAT/exFAT: Fix wrong size detection for files > 4GB
Date: Thu, 25 Aug 2016 12:52:02 +0200 [thread overview]
Message-ID: <CAL9uMOEJs3Ffvv62YdDgaDYCbbmdsyVTm4o4tGN1FpXEGym2WA@mail.gmail.com> (raw)
In-Reply-To: <a57344b1-05e3-c7d0-f06d-1e1567bc7486@gmail.com>
On Wed, Aug 24, 2016 at 9:37 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
> 24.08.2016 16:36, Carlo Caione пишет:
>> From: Carlo Caione <carlo@endlessm.com>
>>
>> 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 <carlo@endlessm.com>
>> ---
>> 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.
--
Carlo Caione | +39.340.80.30.096 | Endless
next prev parent reply other threads:[~2016-08-25 10:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 13:36 [PATCH] Issue reading >4GB loopback image via grub exfat Carlo Caione
2016-08-24 13:36 ` [PATCH] FAT/exFAT: Fix wrong size detection for files > 4GB Carlo Caione
2016-08-24 16:08 ` Vladimir 'phcoder' Serbinenko
2016-08-24 16:12 ` Carlo Caione
2016-08-24 19:37 ` Andrei Borzenkov
2016-08-25 10:52 ` Carlo Caione [this message]
2017-01-27 22:12 ` Vladimir 'phcoder' Serbinenko
2016-08-24 15:53 ` [PATCH] Issue reading >4GB loopback image via grub exfat Vladimir 'phcoder' Serbinenko
2016-08-24 15:58 ` Carlo Caione
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAL9uMOEJs3Ffvv62YdDgaDYCbbmdsyVTm4o4tGN1FpXEGym2WA@mail.gmail.com \
--to=carlo@endlessm.com \
--cc=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).