]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - db/attr.c
libxfs: sanitize agcount on load
[thirdparty/xfsprogs-dev.git] / db / attr.c
index 740d5649755ba203c4bf55ed8342fa85fc82c48b..e26ac67e0232e149a5ba1b3729c66aa3424c00ae 100644 (file)
--- a/db/attr.c
+++ b/db/attr.c
@@ -16,7 +16,7 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <xfs/libxfs.h>
+#include "libxfs.h"
 #include "bit.h"
 #include "type.h"
 #include "faddr.h"
@@ -170,7 +170,7 @@ attr3_leaf_entries_count(
        struct xfs_attr3_leafblock *leaf = obj;
 
        ASSERT(startoff == 0);
-       if (be16_to_cpu(leaf->hdr.info.hdr.magic) != XFS_ATTR_LEAF_MAGIC)
+       if (be16_to_cpu(leaf->hdr.info.hdr.magic) != XFS_ATTR3_LEAF_MAGIC)
                return 0;
        return be16_to_cpu(leaf->hdr.count);
 }
@@ -218,7 +218,7 @@ attr_leaf_entry_walk(
                return 0;
 
        off = byteize(startoff);
-       xfs_attr3_leaf_hdr_from_disk(&leafhdr, leaf);
+       xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
        entries = xfs_attr3_leaf_entryp(leaf);
 
        for (i = 0; i < leafhdr.count; i++) {
@@ -554,7 +554,7 @@ xfs_attr3_db_read_verify(
                break;
        default:
                dbprintf(_("Unknown attribute buffer type!\n"));
-               xfs_buf_ioerror(bp, EFSCORRUPTED);
+               xfs_buf_ioerror(bp, -EFSCORRUPTED);
                return;
        }
 verify:
@@ -566,10 +566,11 @@ xfs_attr3_db_write_verify(
        struct xfs_buf          *bp)
 {
        dbprintf(_("Writing unknown attribute buffer type!\n"));
-       xfs_buf_ioerror(bp, EFSCORRUPTED);
+       xfs_buf_ioerror(bp, -EFSCORRUPTED);
 }
 
 const struct xfs_buf_ops xfs_attr3_db_buf_ops = {
+       .name = "xfs_attr3",
        .verify_read = xfs_attr3_db_read_verify,
        .verify_write = xfs_attr3_db_write_verify,
 };