Author: mckusick
Date: Tue Nov 17 06:04:16 2020
New Revision: 367751
URL: https://svnweb.freebsd.org/changeset/base/367751

Log:
  MFC of 367045.
  
  Avoid improper sign extension in Pass5 inumber checks.
  
  Sponsored by: Netflix

Modified:
  stable/12/sbin/fsck_ffs/pass5.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/fsck_ffs/pass5.c
==============================================================================
--- stable/12/sbin/fsck_ffs/pass5.c     Tue Nov 17 05:59:55 2020        
(r367750)
+++ stable/12/sbin/fsck_ffs/pass5.c     Tue Nov 17 06:04:16 2020        
(r367751)
@@ -63,6 +63,7 @@ pass5(void)
        struct fs *fs = &sblock;
        ufs2_daddr_t d, dbase, dmax, start;
        int rewritecg = 0;
+       ino_t inum;
        struct csum *cs;
        struct csum_total cstotal;
        struct inodesc idesc[3];
@@ -236,9 +237,9 @@ pass5(void)
                }
                memset(&newcg->cg_frsum[0], 0, sizeof newcg->cg_frsum);
                memset(cg_inosused(newcg), 0, (size_t)(mapsize));
-               j = fs->fs_ipg * c;
-               for (i = 0; i < inostathead[c].il_numalloced; j++, i++) {
-                       switch (inoinfo(j)->ino_state) {
+               inum = fs->fs_ipg * c;
+               for (i = 0; i < inostathead[c].il_numalloced; inum++, i++) {
+                       switch (inoinfo(inum)->ino_state) {
 
                        case USTATE:
                                break;
@@ -258,10 +259,10 @@ pass5(void)
                                break;
 
                        default:
-                               if (j < (int)UFS_ROOTINO)
+                               if (inum < UFS_ROOTINO)
                                        break;
-                               errx(EEXIT, "BAD STATE %d FOR INODE I=%d",
-                                   inoinfo(j)->ino_state, j);
+                               errx(EEXIT, "BAD STATE %d FOR INODE I=%ju",
+                                   inoinfo(inum)->ino_state, (uintmax_t)inum);
                        }
                }
                if (c == 0)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to