aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-05-30 05:08:14 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-06-01 08:20:29 -0400
commitea55d30798ac206c9f584ac264b6b8eb093d237a (patch)
tree4de974f44ddcc4d8615b3e761c62924b6b29af9a /fs
parent2ad8ee713566671875216ebcec64f2eda47bd19d (diff)
[JFFS2] Fix buffer length calculations in jffs2_get_inode_nodes()
If we have already read enough bytes, no need to call read_more(). Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/readinode.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 4884d5edfe65..5663e8c7a959 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -1044,7 +1044,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1044 1044
1045 case JFFS2_NODETYPE_DIRENT: 1045 case JFFS2_NODETYPE_DIRENT:
1046 1046
1047 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_dirent)) { 1047 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_dirent) &&
1048 len < sizeof(struct jffs2_raw_dirent)) {
1048 err = read_more(c, ref, sizeof(struct jffs2_raw_dirent), &len, buf); 1049 err = read_more(c, ref, sizeof(struct jffs2_raw_dirent), &len, buf);
1049 if (unlikely(err)) 1050 if (unlikely(err))
1050 goto free_out; 1051 goto free_out;
@@ -1058,7 +1059,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1058 1059
1059 case JFFS2_NODETYPE_INODE: 1060 case JFFS2_NODETYPE_INODE:
1060 1061
1061 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_inode)) { 1062 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_inode) &&
1063 len < sizeof(struct jffs2_raw_inode)) {
1062 err = read_more(c, ref, sizeof(struct jffs2_raw_inode), &len, buf); 1064 err = read_more(c, ref, sizeof(struct jffs2_raw_inode), &len, buf);
1063 if (unlikely(err)) 1065 if (unlikely(err))
1064 goto free_out; 1066 goto free_out;
@@ -1071,7 +1073,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1071 break; 1073 break;
1072 1074
1073 default: 1075 default:
1074 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_unknown_node)) { 1076 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_unknown_node) &&
1077 len < sizeof(struct jffs2_unknown_node)) {
1075 err = read_more(c, ref, sizeof(struct jffs2_unknown_node), &len, buf); 1078 err = read_more(c, ref, sizeof(struct jffs2_unknown_node), &len, buf);
1076 if (unlikely(err)) 1079 if (unlikely(err))
1077 goto free_out; 1080 goto free_out;