Fix detecting of UFS1 label when mediasize%fragsize != 0.

Submitted by:	Stanislav Sedov
PR:		kern/84637
MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2006-09-16 11:24:41 +00:00
parent 1650d24936
commit f8aa16c66c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162357

View file

@ -78,8 +78,8 @@ g_label_ufs_taste(struct g_consumer *cp, char *label, size_t size)
if (fs == NULL)
continue;
/* Check for magic and make sure things are the right size */
if (fs->fs_magic == FS_UFS1_MAGIC &&
fs->fs_old_size * fs->fs_fsize == (int32_t)pp->mediasize) {
if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 &&
pp->mediasize / fs->fs_fsize == fs->fs_old_size) {
/* Valid UFS1. */
} else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 &&
pp->mediasize / fs->fs_fsize == fs->fs_size) {