linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4.4-rc8] jffs2: xattr: Silence frame size warning
@ 2016-01-07 19:11 tim.gardner
  2016-02-01 14:48 ` David Woodhouse
  0 siblings, 1 reply; 2+ messages in thread
From: tim.gardner @ 2016-01-07 19:11 UTC (permalink / raw)
  To: linux-mtd, linux-kernel; +Cc: Tim Gardner, David Woodhouse

From: Tim Gardner <tim.gardner@canonical.com>

fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
fs/jffs2/xattr.c:887:1: warning: the frame size of 1128 bytes is larger than 1024 bytes [-Wframe-larger-than=]
 }

gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)

Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 fs/jffs2/xattr.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 4c2c036..160ddcd 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -775,7 +775,7 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
 void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 {
 	struct jffs2_xattr_ref *ref, *_ref;
-	struct jffs2_xattr_ref *xref_tmphash[XREF_TMPHASH_SIZE];
+	struct jffs2_xattr_ref **xref_tmphash;
 	struct jffs2_xattr_datum *xd, *_xd;
 	struct jffs2_inode_cache *ic;
 	struct jffs2_raw_node_ref *raw;
@@ -784,9 +784,14 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 
 	BUG_ON(!(c->flags & JFFS2_SB_FLAG_BUILDING));
 
+	xref_tmphash = kcalloc(XREF_TMPHASH_SIZE, sizeof(*xref_tmphash),
+		GFP_KERNEL);
+	if (!xref_tmphash) {
+		JFFS2_WARNING("kcalloc failure\n");
+		return;
+	}
+
 	/* Phase.1 : Merge same xref */
-	for (i=0; i < XREF_TMPHASH_SIZE; i++)
-		xref_tmphash[i] = NULL;
 	for (ref=c->xref_temp; ref; ref=_ref) {
 		struct jffs2_xattr_ref *tmp;
 
@@ -884,6 +889,7 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
 		     "%u of xref (%u dead, %u orphan) found.\n",
 		     xdatum_count, xdatum_unchecked_count, xdatum_orphan_count,
 		     xref_count, xref_dead_count, xref_orphan_count);
+	kfree(xref_tmphash);
 }
 
 struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v4.4-rc8] jffs2: xattr: Silence frame size warning
  2016-01-07 19:11 [PATCH v4.4-rc8] jffs2: xattr: Silence frame size warning tim.gardner
@ 2016-02-01 14:48 ` David Woodhouse
  0 siblings, 0 replies; 2+ messages in thread
From: David Woodhouse @ 2016-02-01 14:48 UTC (permalink / raw)
  To: tim.gardner, linux-mtd, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

On Thu, 2016-01-07 at 12:11 -0700, tim.gardner@canonical.com wrote:
> From: Tim Gardner <tim.gardner@canonical.com>
> 
> fs/jffs2/xattr.c: In function 'jffs2_build_xattr_subsystem':
> fs/jffs2/xattr.c:887:1: warning: the frame size of 1128 bytes is
> larger than 1024 bytes [-Wframe-larger-than=]
>  }

At first glance, that looks like it's just bypassing the entire
contents of that function if the allocation fails, leaving the various
data structures in an inconsistent state and raw node refs unchecked,
which will lead to lots of issues later once the mount has completed
and GC can never get unstuck.

So at the very least, your commit message is lacking the explanation of
what the implications are, and *why* you have satisfied yourself that
it's actually OK.

At worst, the patch is entirely broken.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5691 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-01 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 19:11 [PATCH v4.4-rc8] jffs2: xattr: Silence frame size warning tim.gardner
2016-02-01 14:48 ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).