Skip to contentSkip to conversation

yaffs2: iterator variable cannot be NULL

PATCH New Heinrich Schuchardt 2 participants 2 messages Mar 8, 2018 – Mar 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 yaffs2: iterator variable cannot be NULL

The iterator of list_for_each() is never NULL.

Identified with coccinelle.

---
 fs/yaffs2/yaffs_guts.c | 4 ++--
 fs/yaffs2/yaffsfs.c    | 9 +++------
 2 files changed, 5 insertions(+), 8 deletions(-)
fs/yaffs2/yaffs_guts.c +2 -2
index bbe0d700fb..c8b27adda9 100644
@@ -1872,8 +1872,8 @@ static int yaffs_new_obj_id(struct yaffs_dev *dev)
 		n += YAFFS_NOBJECT_BUCKETS;
 		list_for_each(i, &dev->obj_bucket[bucket].list) {
 			/* If there is already one in the list */
-			if (i && list_entry(i, struct yaffs_obj,
-					    hash_link)->obj_id == n) {
+			if (list_entry(i, struct yaffs_obj,
+				       hash_link)->obj_id == n) {
 				found = 0;
 				break;
 			}
fs/yaffs2/yaffsfs.c +3 -6
index ba76a5ccdb..47abc6beda 100644
@@ -2847,12 +2847,9 @@ static void yaffsfs_RemoveObjectCallback(struct yaffs_obj *obj)
 	 * the next one to prevent a hanging ptr.
 	 */
 	list_for_each(i, &search_contexts) {
-		if (i) {
-			dsc = list_entry(i, struct yaffsfs_DirSearchContxt,
-					 others);
-			if (dsc->nextReturn == obj)
-				yaffsfs_DirAdvance(dsc);
-		}
+		dsc = list_entry(i, struct yaffsfs_DirSearchContxt, others);
+		if (dsc->nextReturn == obj)
+			yaffsfs_DirAdvance(dsc);
 	}
 
 }
Signature · 1 line
2.14.2
#1 lore raw

PATCH 1/1 yaffs2: iterator variable cannot be NULL

Quoted 5 lines · Heinrich Schuchardt

The iterator of list_for_each() is never NULL.

Identified with coccinelle.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180309/7cdc657a/attachment.sig>