linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: jffs2: fix error value sign
@ 2010-11-14 20:08 Vasiliy Kulikov
  2010-11-14 20:29 ` Dan Carpenter
  2010-11-26 16:05 ` Artem Bityutskiy
  0 siblings, 2 replies; 6+ messages in thread
From: Vasiliy Kulikov @ 2010-11-14 20:08 UTC (permalink / raw)
  To: kernel-janitors; +Cc: linux-mtd, David Woodhouse, linux-kernel

do_verify_xattr_datum(), do_load_xattr_datum(), load_xattr_datum()
and verify_xattr_ref() should return negative value on error.
Sometimes they return EIO that is positive.  Change this to -EIO.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
---
 This driver is not compilable, so the patch is not tested.

 fs/jffs2/xattr.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 9b572ca..4f9cc04 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -151,7 +151,7 @@ static int do_verify_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_dat
 		JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n",
 			    offset, je32_to_cpu(rx.hdr_crc), crc);
 		xd->flags |= JFFS2_XFLAGS_INVALID;
-		return EIO;
+		return -EIO;
 	}
 	totlen = PAD(sizeof(rx) + rx.name_len + 1 + je16_to_cpu(rx.value_len));
 	if (je16_to_cpu(rx.magic) != JFFS2_MAGIC_BITMASK
@@ -167,7 +167,7 @@ static int do_verify_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_dat
 			    je32_to_cpu(rx.xid), xd->xid,
 			    je32_to_cpu(rx.version), xd->version);
 		xd->flags |= JFFS2_XFLAGS_INVALID;
-		return EIO;
+		return -EIO;
 	}
 	xd->xprefix = rx.xprefix;
 	xd->name_len = rx.name_len;
@@ -230,7 +230,7 @@ static int do_load_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum
 			      ref_offset(xd->node), xd->data_crc, crc);
 		kfree(data);
 		xd->flags |= JFFS2_XFLAGS_INVALID;
-		return EIO;
+		return -EIO;
 	}
 
 	xd->flags |= JFFS2_XFLAGS_HOT;
@@ -268,7 +268,7 @@ static int load_xattr_datum(struct jffs2_sb_info *c, struct jffs2_xattr_datum *x
 	if (xd->xname)
 		return 0;
 	if (xd->flags & JFFS2_XFLAGS_INVALID)
-		return EIO;
+		return -EIO;
 	if (unlikely(is_xattr_datum_unchecked(c, xd)))
 		rc = do_verify_xattr_datum(c, xd);
 	if (!rc)
@@ -460,7 +460,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref
 	if (crc != je32_to_cpu(rr.node_crc)) {
 		JFFS2_ERROR("node CRC failed at %#08x, read=%#08x, calc=%#08x\n",
 			    offset, je32_to_cpu(rr.node_crc), crc);
-		return EIO;
+		return -EIO;
 	}
 	if (je16_to_cpu(rr.magic) != JFFS2_MAGIC_BITMASK
 	    || je16_to_cpu(rr.nodetype) != JFFS2_NODETYPE_XREF
@@ -470,7 +470,7 @@ static int verify_xattr_ref(struct jffs2_sb_info *c, struct jffs2_xattr_ref *ref
 			    offset, je16_to_cpu(rr.magic), JFFS2_MAGIC_BITMASK,
 			    je16_to_cpu(rr.nodetype), JFFS2_NODETYPE_XREF,
 			    je32_to_cpu(rr.totlen), PAD(sizeof(rr)));
-		return EIO;
+		return -EIO;
 	}
 	ref->ino = je32_to_cpu(rr.ino);
 	ref->xid = je32_to_cpu(rr.xid);
-- 
1.7.0.4

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

* Re: [PATCH] fs: jffs2: fix error value sign
  2010-11-14 20:08 [PATCH] fs: jffs2: fix error value sign Vasiliy Kulikov
@ 2010-11-14 20:29 ` Dan Carpenter
  2010-11-15 14:37   ` Vasiliy Kulikov
  2010-11-26 16:05 ` Artem Bityutskiy
  1 sibling, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2010-11-14 20:29 UTC (permalink / raw)
  To: Vasiliy Kulikov; +Cc: David Woodhouse, kernel-janitors, linux-kernel, linux-mtd

On Sun, Nov 14, 2010 at 11:08:39PM +0300, Vasiliy Kulikov wrote:
> do_verify_xattr_datum(), do_load_xattr_datum(), load_xattr_datum()
> and verify_xattr_ref() should return negative value on error.
> Sometimes they return EIO that is positive.  Change this to -EIO.
> 
> Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
> ---
>  This driver is not compilable, so the patch is not tested.
> 

It compiles.

regards,
dan carpenter

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

* Re: [PATCH] fs: jffs2: fix error value sign
  2010-11-14 20:29 ` Dan Carpenter
@ 2010-11-15 14:37   ` Vasiliy Kulikov
  2010-11-15 18:45     ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Vasiliy Kulikov @ 2010-11-15 14:37 UTC (permalink / raw)
  To: Dan Carpenter, kernel-janitors, David Woodhouse, linux-mtd,
	linux-kernel

On Sun, Nov 14, 2010 at 23:29 +0300, Dan Carpenter wrote:
> On Sun, Nov 14, 2010 at 11:08:39PM +0300, Vasiliy Kulikov wrote:
> > do_verify_xattr_datum(), do_load_xattr_datum(), load_xattr_datum()
> > and verify_xattr_ref() should return negative value on error.
> > Sometimes they return EIO that is positive.  Change this to -EIO.
> > 
> > Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
> > ---
> >  This driver is not compilable, so the patch is not tested.
> > 
> 
> It compiles.

Really?

x86_64, linux-next:

make -C /home/vasya/linux fs/jffs2/xattr.o
make: Вход в каталог `/home/vasya/dev/linux-next'
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      fs/jffs2/xattr.o
fs/jffs2/xattr.c: In function ‘unload_xattr_datum’:
fs/jffs2/xattr.c:87: error: ‘struct jffs2_sb_info’ has no member named ‘xdatum_mem_usage’
fs/jffs2/xattr.c: In function ‘reclaim_xattr_datum’: fs/jffs2/xattr.c:105: error: ‘struct jffs2_sb_info’ has no member named
‘xdatum_mem_threshold’ fs/jffs2/xattr.c:105: error: ‘struct jffs2_sb_info’ has no member named
‘xdatum_mem_usage’ fs/jffs2/xattr.c:108: error: ‘struct jffs2_sb_info’ has no member named
‘xdatum_mem_usage’ fs/jffs2/xattr.c:109: error: ‘struct jffs2_sb_info’ has no member named
‘xdatum_mem_usage’ fs/jffs2/xattr.c:110: error: ‘XATTRINDEX_HASHSIZE’ undeclared (first use
in this function) fs/jffs2/xattr.c:110: error: (Each undeclared identifier is reported
only once
fs/jffs2/xattr.c:110: error: for each function it appears in.)


For both defconfig and allyesconfig.

> regards,
> dan carpenter
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Vasiliy

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

* Re: [PATCH] fs: jffs2: fix error value sign
  2010-11-15 14:37   ` Vasiliy Kulikov
@ 2010-11-15 18:45     ` Dan Carpenter
  2010-11-15 19:18       ` Vasiliy Kulikov
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2010-11-15 18:45 UTC (permalink / raw)
  To: Vasiliy Kulikov; +Cc: David Woodhouse, kernel-janitors, linux-kernel, linux-mtd

On Mon, Nov 15, 2010 at 05:37:37PM +0300, Vasiliy Kulikov wrote:
> 
> x86_64, linux-next:
> 
> make -C /home/vasya/linux fs/jffs2/xattr.o
> make: Вход в каталог `/home/vasya/dev/linux-next'
        ^^^^^^^^^^^^^^

This means "Entering directory" right?  So /home/vasya/linux is a
symlink to /home/vasya/dev/linux-next.  It still compiles for me
when I create a symlink and use the -C option...

>   CHK     include/linux/version.h
>   CHK     include/generated/utsrelease.h
>   CALL    scripts/checksyscalls.sh
>   CC      fs/jffs2/xattr.o
> fs/jffs2/xattr.c: In function ‘unload_xattr_datum’:
> fs/jffs2/xattr.c:87: error: ‘struct jffs2_sb_info’ has no member named ‘xdatum_mem_usage’
> fs/jffs2/xattr.c: In function ‘reclaim_xattr_datum’: fs/jffs2/xattr.c:105: error: ‘struct jffs2_sb_info’ has no member named
> ‘xdatum_mem_threshold’ fs/jffs2/xattr.c:105: error: ‘struct jffs2_sb_info’ has no member named
> ‘xdatum_mem_usage’ fs/jffs2/xattr.c:108: error: ‘struct jffs2_sb_info’ has no member named
> ‘xdatum_mem_usage’ fs/jffs2/xattr.c:109: error: ‘struct jffs2_sb_info’ has no member named
> ‘xdatum_mem_usage’ fs/jffs2/xattr.c:110: error: ‘XATTRINDEX_HASHSIZE’ undeclared (first use
> in this function) fs/jffs2/xattr.c:110: error: (Each undeclared identifier is reported
> only once
> fs/jffs2/xattr.c:110: error: for each function it appears in.)
> 

It's not pulling in the CONFIG_JFFS2_FS_XATTR=y for some reason.  Is
there an environment variable which it uses to pull in your config
file?  An allyesconfig or an allmodconfig should work.

regards,
dan carpenter

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

* Re: [PATCH] fs: jffs2: fix error value sign
  2010-11-15 18:45     ` Dan Carpenter
@ 2010-11-15 19:18       ` Vasiliy Kulikov
  0 siblings, 0 replies; 6+ messages in thread
From: Vasiliy Kulikov @ 2010-11-15 19:18 UTC (permalink / raw)
  To: Dan Carpenter, kernel-janitors, David Woodhouse, linux-mtd,
	linux-kernel

On Mon, Nov 15, 2010 at 21:45 +0300, Dan Carpenter wrote:
> On Mon, Nov 15, 2010 at 05:37:37PM +0300, Vasiliy Kulikov wrote:
> > 
> > x86_64, linux-next:
> > 
> > make -C /home/vasya/linux fs/jffs2/xattr.o
> > make: Вход в каталог `/home/vasya/dev/linux-next'
>         ^^^^^^^^^^^^^^
> 
> This means "Entering directory" right?  So /home/vasya/linux is a
> symlink to /home/vasya/dev/linux-next.  It still compiles for me
> when I create a symlink and use the -C option...

Correct, but the same with cd ~linux/ && make fs/jffs2/xattr.o.

I've just updated to next-2010111 and it became compilable ;)
linux next is just very nonstable...

Thanks,

-- 
Vasiliy

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

* Re: [PATCH] fs: jffs2: fix error value sign
  2010-11-14 20:08 [PATCH] fs: jffs2: fix error value sign Vasiliy Kulikov
  2010-11-14 20:29 ` Dan Carpenter
@ 2010-11-26 16:05 ` Artem Bityutskiy
  1 sibling, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2010-11-26 16:05 UTC (permalink / raw)
  To: Vasiliy Kulikov; +Cc: David Woodhouse, kernel-janitors, linux-kernel, linux-mtd

On Sun, 2010-11-14 at 23:08 +0300, Vasiliy Kulikov wrote:
> do_verify_xattr_datum(), do_load_xattr_datum(), load_xattr_datum()
> and verify_xattr_ref() should return negative value on error.
> Sometimes they return EIO that is positive.  Change this to -EIO.
> 
> Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>

Pushed to l2-mtd-2.6.git, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

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

end of thread, other threads:[~2010-11-26 16:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-14 20:08 [PATCH] fs: jffs2: fix error value sign Vasiliy Kulikov
2010-11-14 20:29 ` Dan Carpenter
2010-11-15 14:37   ` Vasiliy Kulikov
2010-11-15 18:45     ` Dan Carpenter
2010-11-15 19:18       ` Vasiliy Kulikov
2010-11-26 16:05 ` Artem Bityutskiy

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).