isofs: fix timestamps beyond 2027
Subsystems (3)
PATCH 1/1 isofs: fix timestamps beyond 2027
isofs uses a 'char' variable to load the number of years since 1900 for an inode timestamp. On architectures that use a signed char type by default, this results in an invalid date for anything beyond 2027.
This adds a cast to 'u8' for the year number, which should extend the shelf life of the file system until 2155.
This should be backported to all kernels that might still be in use by that date.
--- fs/isofs/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/isofs/util.c +1 -1
@@ -20,7 +20,7 @@ int iso_date(char * p, int flag)int year, month, day, hour, minute, second, tz;int crtime; - year = p[0 ]; + year = (int )(u8 )p[0 ]; month = p[1 ]; day = p[2 ]; hour = p[3 ];
Signature · 1 line
2.9.0
Al Viro
maintainerQuoted 22 lines · Arnd Bergmann
isofs uses a 'char' variable to load the number of years since 1900 for an inode timestamp. On architectures that use a signed char type by default, this results in an invalid date for anything beyond 2027.
This adds a cast to 'u8' for the year number, which should extend the shelf life of the file system until 2155.
This should be backported to all kernels that might still be in use by that date.
Signed-off-by Arnd Bergmann <[email protected]>--- fs/isofs/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/isofs/util.c +0
-0
fs/isofs/util.c int iso_date(char * p, int flag) · line 23
Quoted 5 lines
fs/isofs/util.c +1
-1@@ -20,7 +20,7 @@ int iso_date(char * p, int flag)int year, month, day, hour, minute, second, tz;int crtime; - year = p[0 ]; + year = (int )(u8 )p[0 ];
This is BS; just turn that
char time[7]; in struct stamp into unsigned char time[7];
and adjust iso_date() accordingly. Or make that sucker actually take struct stamp *, while we are at it.
And I'd suggest going through the rest of on-disk structures in rock.h and looking for other trouble of that sort.
Quoted 32 lines · On Thursday, 19 October 2017 12:51:05 CEST Al Viro wrote:
Quoted 23 lines · Arnd Bergmann
isofs uses a 'char' variable to load the number of years since 1900 for an inode timestamp. On architectures that use a signed char type by default, this results in an invalid date for anything beyond 2027.
This adds a cast to 'u8' for the year number, which should extend the shelf life of the file system until 2155.
This should be backported to all kernels that might still be in use by that date.
Signed-off-by Arnd Bergmann <[email protected]>---
fs/isofs/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/isofs/util.c +0
-0fs/isofs/util.c int iso_date(char * p, int flag) · line 24
Quoted 6 lines
fs/isofs/util.c +1
-1@@ -20,7 +20,7 @@ int iso_date(char * p, int flag)int year, month, day, hour, minute, second, tz;int crtime; - year = p[0 ]; + year = (int )(u8 )p[0 ];This is BS; just turn that
Quoted 8 lines
char time[7]; in struct stamp into unsigned char time[7];and adjust
iso_date()accordingly. Or make that sucker actually take struct stamp *, while we are at it.And I'd suggest going through the rest of on-disk structures in
rock.hand looking for other trouble of that sort.
There are more candidates in include/uapi/linux/iso_fs.h - most of them seems to be unused (by us), but at the very least struct iso_directory_record contains a date-field of the same sort that is indeed used.
Cheers
Anders