[Git][lvmteam/lvm2][main] lvresize: fix 32 bit overflow in size calculation

"David Teigland (@teigland)" <[email protected]>
Newsgroups gmane.linux.lvm.devel
Message-ID <64ff4c6556015_28846a84984fd@gitlab-sidekiq-low-urgency-cpu-bound-v2-5f6c477dc8-fhd6n.mail>

David Teigland pushed to branch main at LVM team / lvm2


Commits:
fa496513 by David Teigland at 2023-09-11T12:18:12-05:00
lvresize: fix 32 bit overflow in size calculation

- - - - -


1 changed file:

- lib/metadata/lv_manip.c


Changes:

=====================================
lib/metadata/lv_manip.c
=====================================
@@ -6445,7 +6445,7 @@ static int _fs_reduce(struct cmd_context *cmd, struct logical_volume *lv,
 	}
 
 	/* extent_size units is SECTOR_SIZE (512) */
-	newsize_bytes_lv = lp->extents * lv->vg->extent_size * SECTOR_SIZE;
+	newsize_bytes_lv = (uint64_t) lp->extents * lv->vg->extent_size * SECTOR_SIZE;
 	newsize_bytes_fs = newsize_bytes_lv;
 
 	/*
@@ -6591,7 +6591,7 @@ static int _fs_extend(struct cmd_context *cmd, struct logical_volume *lv,
 	 */
 
 	/* extent_size units is SECTOR_SIZE (512) */
-	newsize_bytes_lv = lp->extents * lv->vg->extent_size * SECTOR_SIZE;
+	newsize_bytes_lv = (uint64_t) lp->extents * lv->vg->extent_size * SECTOR_SIZE;
 	newsize_bytes_fs = newsize_bytes_lv;
 	if (fsinfo.needs_crypt) {
 		newsize_bytes_fs -= fsinfo.crypt_offset_bytes;



View it on GitLab: https://gitlab.com/lvmteam/lvm2/-/commit/fa496513010976aac21584b5081529b76462f9a9

-- 
View it on GitLab: https://gitlab.com/lvmteam/lvm2/-/commit/fa496513010976aac21584b5081529b76462f9a9
You're receiving this email because of your account on gitlab.com.

--
lvm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/lvm-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.