All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] cifs: update a check for NULL function pointer
@ 2014-08-26  7:38 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-08-26  7:38 UTC (permalink / raw)
  To: Steve French, Pavel Shilovsky
  Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 41e52e2..d2141f1 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -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);

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

* [patch] cifs: update a check for NULL function pointer
@ 2014-08-26  7:38 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-08-26  7:38 UTC (permalink / raw)
  To: Steve French, Pavel Shilovsky
  Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

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.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 41e52e2..d2141f1 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -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);

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

* Re: [patch] cifs: update a check for NULL function pointer
  2014-08-26  7:38 ` Dan Carpenter
@ 2014-08-26  8:21   ` Pavel Shilovsky
  -1 siblings, 0 replies; 8+ messages in thread
From: Pavel Shilovsky @ 2014-08-26  8:21 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Steve French, linux-cifs, samba-technical, kernel-janitors

2014-08-26 11:38 GMT+04:00 Dan Carpenter <dan.carpenter@oracle.com>:
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
> index 41e52e2..d2141f1 100644
> --- a/fs/cifs/readdir.c
> +++ b/fs/cifs/readdir.c
> @@ -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);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> 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?

-- 
Best regards,
Pavel Shilovsky.

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

* Re: [patch] cifs: update a check for NULL function pointer
@ 2014-08-26  8:21   ` Pavel Shilovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Pavel Shilovsky @ 2014-08-26  8:21 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Steve French, linux-cifs, samba-technical, kernel-janitors

2014-08-26 11:38 GMT+04:00 Dan Carpenter <dan.carpenter@oracle.com>:
> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
> index 41e52e2..d2141f1 100644
> --- a/fs/cifs/readdir.c
> +++ b/fs/cifs/readdir.c
> @@ -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);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> 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?

-- 
Best regards,
Pavel Shilovsky.

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

* Re: [patch] cifs: update a check for NULL function pointer
       [not found]   ` <CAKywueS8pjGrY=SkmxSazVTYVMmnj7zrNhcPCWYgf7NNrNZnYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-08-26 12:25       ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-08-26 12:25 UTC (permalink / raw)
  To: Pavel Shilovsky
  Cc: Steve French, linux-cifs, samba-technical,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Tue, Aug 26, 2014 at 12:21:07PM +0400, Pavel Shilovsky wrote:
> 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


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

* Re: [patch] cifs: update a check for NULL function pointer
@ 2014-08-26 12:25       ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-08-26 12:25 UTC (permalink / raw)
  To: Pavel Shilovsky
  Cc: Steve French, linux-cifs, samba-technical,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Tue, Aug 26, 2014 at 12:21:07PM +0400, Pavel Shilovsky wrote:
> 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

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

* Re: [patch] cifs: update a check for NULL function pointer
  2014-08-26 12:25       ` Dan Carpenter
@ 2014-08-26 15:35         ` Pavel Shilovsky
  -1 siblings, 0 replies; 8+ messages in thread
From: Pavel Shilovsky @ 2014-08-26 15:35 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Steve French, linux-cifs, samba-technical, kernel-janitors

2014-08-26 16:25 GMT+04:00 Dan Carpenter <dan.carpenter@oracle.com>:
> On Tue, Aug 26, 2014 at 12:21:07PM +0400, Pavel Shilovsky wrote:
>> 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.

-- 
Best regards,
Pavel Shilovsky.

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

* Re: [patch] cifs: update a check for NULL function pointer
@ 2014-08-26 15:35         ` Pavel Shilovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Pavel Shilovsky @ 2014-08-26 15:35 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Steve French, linux-cifs, samba-technical, kernel-janitors

2014-08-26 16:25 GMT+04:00 Dan Carpenter <dan.carpenter@oracle.com>:
> On Tue, Aug 26, 2014 at 12:21:07PM +0400, Pavel Shilovsky wrote:
>> 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.

-- 
Best regards,
Pavel Shilovsky.

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

end of thread, other threads:[~2014-08-26 15:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-26  7:38 [patch] cifs: update a check for NULL function pointer Dan Carpenter
2014-08-26  7:38 ` Dan Carpenter
2014-08-26  8:21 ` Pavel Shilovsky
2014-08-26  8:21   ` Pavel Shilovsky
     [not found]   ` <CAKywueS8pjGrY=SkmxSazVTYVMmnj7zrNhcPCWYgf7NNrNZnYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-26 12:25     ` Dan Carpenter
2014-08-26 12:25       ` Dan Carpenter
2014-08-26 15:35       ` Pavel Shilovsky
2014-08-26 15:35         ` Pavel Shilovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.