linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jffs2: remove unneeded conditions
@ 2015-06-27  8:07 Wei Fang
  2015-07-07 20:18 ` Brian Norris
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Fang @ 2015-06-27  8:07 UTC (permalink / raw)
  To: computersforpeace, dwmw2; +Cc: linux-mtd

Since len must not be smaller than JFFS2_MIN_NODE_HEADER, if
"len < X" is true, than "JFFS2_MIN_NODE_HEADER < X" must be true,
so it can be removed.

Signed-off-by: Wei Fang <fangwei1@huawei.com>
---
 fs/jffs2/readinode.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index dddbde4..b9bd3ad 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -1059,8 +1059,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf

 		case JFFS2_NODETYPE_DIRENT:

-			if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_dirent) &&
-			    len < sizeof(struct jffs2_raw_dirent)) {
+			if (len < sizeof(struct jffs2_raw_dirent)) {
 				err = read_more(c, ref, sizeof(struct jffs2_raw_dirent), &len, buf);
 				if (unlikely(err))
 					goto free_out;
@@ -1074,8 +1073,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf

 		case JFFS2_NODETYPE_INODE:

-			if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_inode) &&
-			    len < sizeof(struct jffs2_raw_inode)) {
+			if (len < sizeof(struct jffs2_raw_inode)) {
 				err = read_more(c, ref, sizeof(struct jffs2_raw_inode), &len, buf);
 				if (unlikely(err))
 					goto free_out;
@@ -1088,8 +1086,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
 			break;

 		default:
-			if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_unknown_node) &&
-			    len < sizeof(struct jffs2_unknown_node)) {
+			if (len < sizeof(struct jffs2_unknown_node)) {
 				err = read_more(c, ref, sizeof(struct jffs2_unknown_node), &len, buf);
 				if (unlikely(err))
 					goto free_out;
-- 
1.8.3.1

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

end of thread, other threads:[~2015-07-09  2:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-27  8:07 [PATCH] jffs2: remove unneeded conditions Wei Fang
2015-07-07 20:18 ` Brian Norris
2015-07-08  1:45   ` Sheng Yong
2015-07-09  2:02     ` Wei Fang

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