hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/jffs2/xattr.c
....@@ -772,10 +772,10 @@
772772 }
773773
774774 #define XREF_TMPHASH_SIZE (128)
775
-void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
775
+int jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
776776 {
777777 struct jffs2_xattr_ref *ref, *_ref;
778
- struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE];
778
+ struct jffs2_xattr_ref **xref_tmphash;
779779 struct jffs2_xattr_datum *xd, *_xd;
780780 struct jffs2_inode_cache *ic;
781781 struct jffs2_raw_node_ref *raw;
....@@ -784,9 +784,12 @@
784784
785785 BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING));
786786
787
+ xref_tmphash = kcalloc(XREF_TMPHASH_SIZE,
788
+ sizeof(struct jffs2_xattr_ref *), GFP_KERNEL);
789
+ if (!xref_tmphash)
790
+ return -ENOMEM;
791
+
787792 /* Phase.1 : Merge same xref */
788
- for (i=0; i < XREF_TMPHASH_SIZE; i++)
789
- xref_tmphash[i] = NULL;
790793 for (ref=c->xref_temp; ref; ref=_ref) {
791794 struct jffs2_xattr_ref *tmp;
792795
....@@ -884,6 +887,8 @@
884887 "%u of xref (%u dead, %u orphan) found.\n",
885888 xdatum_count, xdatum_unchecked_count, xdatum_orphan_count,
886889 xref_count, xref_dead_count, xref_orphan_count);
890
+ kfree(xref_tmphash);
891
+ return 0;
887892 }
888893
889894 struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,