lkml.org 
[lkml]   [2020]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] isofs: fix High Sierra dirent flag accesses
On Sun, Jun 21, 2020 at 07:08:17AM +0300, Egor Chelak wrote:
> The flags byte of the dirent was accessed as de->flags[0] in a couple of
> places, and not as de->flags[-sbi->s_high_sierra], which is how it's
> accessed elsewhere. This caused a bug, where some files on an HSF disc
> could be inaccessible.
>
> For context, here is the difference between HSF dirents and ISO dirents:
> Offset | High Sierra | ISO-9660 | struct iso_directory_record
> Byte 24 | Flags | mtime timezone | de->date[6] (de->flags[-1])
> Byte 25 | Reserved | Flags | de->flags[0]

Also, ew. Why on earth do we do 'de->flags[-sbi->s_high_sierra]'?
I'm surprised we don't have any tools that warn about references outside
an array. I would do this as ...

static inline u8 de_flags(struct isofs_sb_info *sbi,
struct iso_directory_record *de)
{
if (sbi->s_high_sierra)
return de->date[6];
return de->flags;
}

\
 
 \ /
  Last update: 2020-06-22 23:32    [W:0.040 / U:1.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site