Skip to contentSkip to conversation

cifs: update a check for NULL function pointer

PATCH In review Dan Carpenter 2 participants 4 messages Aug 26, 2014 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: update a check for NULL function pointer

We changed the function call from ->close() to ->close_dir() so we should update the test for NULL as well.

Both of them probably work, but my static checker complains when we have a check for a NULL function pointer and then immediately call a different function pointer. This is a common cut and paste error.

fs/cifs/readdir.c +1 -1
index 41e52e2..d2141f1 100644
@@ -592,7 +592,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos,
 		if (server->ops->dir_needs_close(cfile)) {
 			cfile->invalidHandle = true;
 			spin_unlock(&cifs_file_list_lock);
-			if (server->ops->close)
+			if (server->ops->close_dir)
 				server->ops->close_dir(xid, tcon, &cfile->fid);
 		} else
 			spin_unlock(&cifs_file_list_lock);
#1 lore raw

2014-08-26 11:38 GMT+04:00 Dan Carpenter <[email protected]>:

Quoted 23 lines

We changed the function call from ->close() to ->close_dir() so we should update the test for NULL as well.

Both of them probably work, but my static checker complains when we have a check for a NULL function pointer and then immediately call a different function pointer. This is a common cut and paste error.

fs/cifs/readdir.c +1 -2
index 41e52e2..d2141f1 100644
@@ -592,7 +592,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos,
                if (server->ops->dir_needs_close(cfile)) {
                        cfile->invalidHandle = true;
                        spin_unlock(&cifs_file_list_lock);
-                       if (server->ops->close)
+                       if (server->ops->close_dir)
                                server->ops->close_dir(xid, tcon, &cfile->fid);
                } else
                        spin_unlock(&cifs_file_list_lock);
--
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

This looks right, thanks.

Dan, would you mind if I merge your code change as well as your Signed-off-by line into the original patch "CIFS: Fix wrong restart readdir for SMB1" since the latter hasn't been merged into the mainline yet?

Signature · 2 lines
Best regards,
Pavel Shilovsky.

A message that is not in the archive (sent off-list or not yet received): CAKywueS8pjGrY=SkmxSazVTYVMmnj7zrNhcPCWYgf7NNrNZnYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#3 lore raw
Quoted 5 lines · Pavel Shilovsky

Dan, would you mind if I merge your code change as well as your Signed-off-by line into the original patch "CIFS: Fix wrong restart readdir for SMB1" since the latter hasn't been merged into the mainline yet?

Sure. No problem.

regards,
dan carpenter

#4 lore raw

2014-08-26 16:25 GMT+04:00 Dan Carpenter <[email protected]>:

Quoted 8 lines · Pavel Shilovsky
Quoted 5 lines

Dan, would you mind if I merge your code change as well as your Signed-off-by line into the original patch "CIFS: Fix wrong restart readdir for SMB1" since the latter hasn't been merged into the mainline yet?

Sure. No problem.

Thanks. Posted the second version to the list.

Signature · 2 lines
Best regards,
Pavel Shilovsky.