* [PATCH] cifs: use type __u32 instead of int for the oplock parameter
@ 2010-09-17 14:13 Suresh Jayaraman
[not found] ` <4C937776.909-l3A5Bk7waGM@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Suresh Jayaraman @ 2010-09-17 14:13 UTC (permalink / raw)
To: Steve French; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA
... and avoid implicit casting from a signed type. Also, pass oplock by value
instead by reference as we don't intend to change the value in
cifs_open_inode_helper().
Thanks to Jeff Layton for spotting this.
Signed-off-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
---
fs/cifs/file.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index de748c6..d33da45 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -165,7 +165,7 @@ psx_client_can_cache:
/* all arguments to this function must be checked for validity in caller */
static inline int cifs_open_inode_helper(struct inode *inode,
- struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf,
+ struct cifsTconInfo *pTcon, __u32 oplock, FILE_ALL_INFO *buf,
char *full_path, int xid)
{
struct cifsInodeInfo *pCifsInode = CIFS_I(inode);
@@ -207,11 +207,11 @@ client_can_cache:
rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
xid, NULL);
- if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
+ if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = true;
cFYI(1, "Exclusive Oplock granted on inode %p", inode);
- } else if ((*oplock & 0xF) == OPLOCK_READ)
+ } else if ((oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = true;
return rc;
@@ -365,7 +365,7 @@ int cifs_open(struct inode *inode, struct file *file)
goto out;
}
- rc = cifs_open_inode_helper(inode, tcon, &oplock, buf, full_path, xid);
+ rc = cifs_open_inode_helper(inode, tcon, oplock, buf, full_path, xid);
if (rc != 0)
goto out;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cifs: use type __u32 instead of int for the oplock parameter
[not found] ` <4C937776.909-l3A5Bk7waGM@public.gmane.org>
@ 2010-09-17 14:39 ` Jeff Layton
[not found] ` <20100917103957.5cbde780-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2010-09-17 14:39 UTC (permalink / raw)
To: Suresh Jayaraman; +Cc: Steve French, linux-cifs-u79uwXL29TY76Z2rM5mHXA
On Fri, 17 Sep 2010 19:43:10 +0530
Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org> wrote:
> ... and avoid implicit casting from a signed type. Also, pass oplock by value
> instead by reference as we don't intend to change the value in
> cifs_open_inode_helper().
>
> Thanks to Jeff Layton for spotting this.
>
> Signed-off-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
> ---
>
> fs/cifs/file.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index de748c6..d33da45 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -165,7 +165,7 @@ psx_client_can_cache:
>
> /* all arguments to this function must be checked for validity in caller */
> static inline int cifs_open_inode_helper(struct inode *inode,
> - struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf,
> + struct cifsTconInfo *pTcon, __u32 oplock, FILE_ALL_INFO *buf,
> char *full_path, int xid)
> {
> struct cifsInodeInfo *pCifsInode = CIFS_I(inode);
> @@ -207,11 +207,11 @@ client_can_cache:
> rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
> xid, NULL);
>
> - if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
> + if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
> pCifsInode->clientCanCacheAll = true;
> pCifsInode->clientCanCacheRead = true;
> cFYI(1, "Exclusive Oplock granted on inode %p", inode);
> - } else if ((*oplock & 0xF) == OPLOCK_READ)
> + } else if ((oplock & 0xF) == OPLOCK_READ)
> pCifsInode->clientCanCacheRead = true;
>
> return rc;
> @@ -365,7 +365,7 @@ int cifs_open(struct inode *inode, struct file *file)
> goto out;
> }
>
> - rc = cifs_open_inode_helper(inode, tcon, &oplock, buf, full_path, xid);
> + rc = cifs_open_inode_helper(inode, tcon, oplock, buf, full_path, xid);
> if (rc != 0)
> goto out;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Reviewed-by: Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cifs: use type __u32 instead of int for the oplock parameter
[not found] ` <20100917103957.5cbde780-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
@ 2010-09-17 21:42 ` Steve French
0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2010-09-17 21:42 UTC (permalink / raw)
To: Jeff Layton; +Cc: Suresh Jayaraman, linux-cifs-u79uwXL29TY76Z2rM5mHXA
Obviously correct (and merged this along with the previous patch from you).
Wonder why sparse didn't spot this - we avoided the cast in the other
(posix) helper.
On Fri, Sep 17, 2010 at 9:39 AM, Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org> wrote:
> On Fri, 17 Sep 2010 19:43:10 +0530
> Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org> wrote:
>
>> ... and avoid implicit casting from a signed type. Also, pass oplock by value
>> instead by reference as we don't intend to change the value in
>> cifs_open_inode_helper().
>>
>> Thanks to Jeff Layton for spotting this.
>>
>> Signed-off-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
>> ---
>>
>> fs/cifs/file.c | 8 ++++----
>> 1 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
>> index de748c6..d33da45 100644
>> --- a/fs/cifs/file.c
>> +++ b/fs/cifs/file.c
>> @@ -165,7 +165,7 @@ psx_client_can_cache:
>>
>> /* all arguments to this function must be checked for validity in caller */
>> static inline int cifs_open_inode_helper(struct inode *inode,
>> - struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf,
>> + struct cifsTconInfo *pTcon, __u32 oplock, FILE_ALL_INFO *buf,
>> char *full_path, int xid)
>> {
>> struct cifsInodeInfo *pCifsInode = CIFS_I(inode);
>> @@ -207,11 +207,11 @@ client_can_cache:
>> rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
>> xid, NULL);
>>
>> - if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
>> + if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
>> pCifsInode->clientCanCacheAll = true;
>> pCifsInode->clientCanCacheRead = true;
>> cFYI(1, "Exclusive Oplock granted on inode %p", inode);
>> - } else if ((*oplock & 0xF) == OPLOCK_READ)
>> + } else if ((oplock & 0xF) == OPLOCK_READ)
>> pCifsInode->clientCanCacheRead = true;
>>
>> return rc;
>> @@ -365,7 +365,7 @@ int cifs_open(struct inode *inode, struct file *file)
>> goto out;
>> }
>>
>> - rc = cifs_open_inode_helper(inode, tcon, &oplock, buf, full_path, xid);
>> + rc = cifs_open_inode_helper(inode, tcon, oplock, buf, full_path, xid);
>> if (rc != 0)
>> goto out;
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> Reviewed-by: Jeff Layton <jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-17 21:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-17 14:13 [PATCH] cifs: use type __u32 instead of int for the oplock parameter Suresh Jayaraman
[not found] ` <4C937776.909-l3A5Bk7waGM@public.gmane.org>
2010-09-17 14:39 ` Jeff Layton
[not found] ` <20100917103957.5cbde780-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-09-17 21:42 ` Steve French
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.