diff mbox

jffs2:Fix error paths return value for the function read_unknown

Message ID 1436389195-16522-1-git-send-email-xerofoify@gmail.com
State Rejected
Headers show

Commit Message

Nicholas Krause July 8, 2015, 8:59 p.m. UTC
This fixes the error paths in the function read_unknown that return
a value to correctly return -EIO rather then the kernel value for
successful function execution of zero to indicate to this function's
callers that a failure has occurred related to I/O and needs to be
handled by this function's caller.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 fs/jffs2/readinode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Richard Weinberger July 8, 2015, 9:20 p.m. UTC | #1
On Wed, Jul 8, 2015 at 10:59 PM, Nicholas Krause <xerofoify@gmail.com> wrote:
> This fixes the error paths in the function read_unknown that return
> a value to correctly return -EIO rather then the kernel value for
> successful function execution of zero to indicate to this function's
> callers that a failure has occurred related to I/O and needs to be
> handled by this function's caller.

Did you test this patch?
I guess not.
Nicholas Krause July 8, 2015, 9:20 p.m. UTC | #2
On 2015-07-08 05:20 PM, Richard Weinberger wrote:
> On Wed, Jul 8, 2015 at 10:59 PM, Nicholas Krause <xerofoify@gmail.com> wrote:
>> This fixes the error paths in the function read_unknown that return
>> a value to correctly return -EIO rather then the kernel value for
>> successful function execution of zero to indicate to this function's
>> callers that a failure has occurred related to I/O and needs to be
>> handled by this function's caller.
> 
> Did you test this patch?
> I guess not.
> 
No I don't have hardware why?
Nick
Richard Weinberger July 8, 2015, 9:27 p.m. UTC | #3
Am 08.07.2015 um 23:20 schrieb nick:
> 
> 
> On 2015-07-08 05:20 PM, Richard Weinberger wrote:
>> On Wed, Jul 8, 2015 at 10:59 PM, Nicholas Krause <xerofoify@gmail.com> wrote:
>>> This fixes the error paths in the function read_unknown that return
>>> a value to correctly return -EIO rather then the kernel value for
>>> successful function execution of zero to indicate to this function's
>>> callers that a failure has occurred related to I/O and needs to be
>>> handled by this function's caller.
>>
>> Did you test this patch?
>> I guess not.
>>
> No I don't have hardware why?

It is broken.
Both paths are not fatal errors and the soft error
is already handled by calling jffs2_mark_node_obsolete().

Thanks,
//richard
Richard Weinberger July 8, 2015, 9:28 p.m. UTC | #4
>> On Wed, Jul 8, 2015 at 10:59 PM, Nicholas Krause <xerofoify@gmail.com> wrote:

Oh, damn. I should have stopped reading here. /ignore.

Thanks,
//richard
diff mbox

Patch

diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 28e0aab..63bf879 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -875,7 +875,7 @@  static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_re
 			    je16_to_cpu(un->magic), je16_to_cpu(un->nodetype),
 			    je32_to_cpu(un->totlen), je32_to_cpu(un->hdr_crc));
 		jffs2_mark_node_obsolete(c, ref);
-		return 0;
+		return -EIO;
 	}
 
 	un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype));
@@ -904,7 +904,7 @@  static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_re
 		JFFS2_NOTICE("unknown RWCOMPAT_DELETE nodetype %#04X at %#08x\n",
 			     je16_to_cpu(un->nodetype), ref_offset(ref));
 		jffs2_mark_node_obsolete(c, ref);
-		return 0;
+		return -EIO;
 	}
 
 	return 0;