xfs_lsn_t                       lsn)
 {
        struct xfs_efd_log_format       *efd_formatp;
+       int                             buflen = item->ri_buf[0].i_len;
 
        efd_formatp = item->ri_buf[0].i_addr;
-       ASSERT(item->ri_buf[0].i_len == xfs_efd_log_format32_sizeof(
-                                               efd_formatp->efd_nextents) ||
-              item->ri_buf[0].i_len == xfs_efd_log_format64_sizeof(
-                                               efd_formatp->efd_nextents));
+
+       if (buflen < sizeof(struct xfs_efd_log_format)) {
+               XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
+                               efd_formatp, buflen);
+               return -EFSCORRUPTED;
+       }
+
+       if (item->ri_buf[0].i_len != xfs_efd_log_format32_sizeof(
+                                               efd_formatp->efd_nextents) &&
+           item->ri_buf[0].i_len != xfs_efd_log_format64_sizeof(
+                                               efd_formatp->efd_nextents)) {
+               XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
+                               efd_formatp, buflen);
+               return -EFSCORRUPTED;
+       }
 
        xlog_recover_release_intent(log, XFS_LI_EFI, efd_formatp->efd_efi_id);
        return 0;
 
        struct xfs_rud_log_format       *rud_formatp;
 
        rud_formatp = item->ri_buf[0].i_addr;
-       ASSERT(item->ri_buf[0].i_len == sizeof(struct xfs_rud_log_format));
+       if (item->ri_buf[0].i_len != sizeof(struct xfs_rud_log_format)) {
+               XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, log->l_mp,
+                               rud_formatp, item->ri_buf[0].i_len);
+               return -EFSCORRUPTED;
+       }
 
        xlog_recover_release_intent(log, XFS_LI_RUI, rud_formatp->rud_rui_id);
        return 0;