Skip to contentSkip to conversation

udf: Avoid overflow when session starts at large offset

PATCH New Jan Kara 1 participant 1 message Oct 16, 2017

Subsystems (2)
lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 udf: Avoid overflow when session starts at large offset

When session starts beyond offset 2^31 the arithmetics in udf_check_vsd() would overflow. Make sure the computation is done in large enough type.

---
 fs/udf/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I will queue this patch into my tree.

fs/udf/super.c +1 -1
index 99cb81d0077f..08bf097507f6 100644
@@ -703,7 +703,7 @@ static loff_t udf_check_vsd(struct super_block *sb)
 	else
 		sectorsize = sb->s_blocksize;
 
-	sector += (sbi->s_session << sb->s_blocksize_bits);
+	sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits);
 
 	udf_debug("Starting at sector %u (%ld byte sectors)\n",
 		  (unsigned int)(sector >> sb->s_blocksize_bits),
Signature · 1 line
2.12.3