+/* Fix the security ID for every inode to be either -1 or in bounds. */
+static void
+fix_security_ids(struct wim_image_metadata *imd, const u32 num_entries)
+{
+ struct wim_inode *inode;
+ unsigned long invalid_count = 0;
+
+ image_for_each_inode(inode, imd) {
+ if ((u32)inode->i_security_id >= num_entries) {
+ if (inode->i_security_id >= 0)
+ invalid_count++;
+ inode->i_security_id = -1;
+ }
+ }
+ if (invalid_count)
+ WARNING("%lu inodes had invalid security IDs", invalid_count);
+}
+