On Tue, May 17, 2016 at 10:22:20AM -0400, Lidza Louina wrote:
> if (rc < 0) and if (rc) pretty much translates to the same thing.
I wasn't talking about this patch in particular; it's just something I
have thinking about recently. For example, there are a lot of functions
that don't initialize pa
On 05/17/2016 02:53 AM, Dan Carpenter wrote:
When I read the code, I just assumed desc was a pointer and it should
have been:
if (!desc)
return NULL;
For me, "if (rc) " is way more readable than "if (rc != 0) ". So
readability could go either way depending on what you
When I read the code, I just assumed desc was a pointer and it should
have been:
if (!desc)
return NULL;
For me, "if (rc) " is way more readable than "if (rc != 0) ". So
readability could go either way depending on what you're used to, I
suppose.
It should definitely ==
On 05/16/2016 02:35 PM, Dilger, Andreas wrote:
On 2016/05/16, 12:16, "James Simmons" wrote:
This looks wrong - You return -EINVAL from sptlrpc_pack_user_desc, but then
the caller checks "!desc". Desc will not be null, since you've returned
-EINVAL.
Actually 'if (!desc)' is equal to 'if (de
On 2016/05/16, 12:16, "James Simmons" wrote:
>
>> This looks wrong - You return -EINVAL from sptlrpc_pack_user_desc, but then
>> the caller checks "!desc". Desc will not be null, since you've returned
>> -EINVAL.
>
>Actually 'if (!desc)' is equal to 'if (desc != 0). Yes it can be confusing.
Ver
James,
No. You've got it backwards. 0 is false, any non-zero value is true.
if(desc) would be equal to if (desc != 0).
- Patrick
On 05/16/2016 01:16 PM, James Simmons wrote:
This looks wrong - You return -EINVAL from sptlrpc_pack_user_desc, but then
the caller checks "!desc". Desc will no
> James,
>
> No. You've got it backwards. 0 is false, any non-zero value is true.
>
> if(desc) would be equal to if (desc != 0).
Ah, you are right. Didn't get much sleep last night :-(
> - Patrick
>
> On 05/16/2016 01:16 PM, James Simmons wrote:
> > > This looks wrong - You return -EINVAL
> This looks wrong - You return -EINVAL from sptlrpc_pack_user_desc, but then
> the caller checks "!desc". Desc will not be null, since you've returned
> -EINVAL.
Actually 'if (!desc)' is equal to 'if (desc != 0). Yes it can be confusing.
I recommend 'if (desc < 0)' instead to make it clearer wh
The lustre_msg_buf method could return NULL. Subsequent code didn't
check if it's null before using it. This patch adds two checks.
Signed-off-by: Lidza Louina
---
drivers/staging/lustre/lustre/ptlrpc/sec.c | 2 ++
drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 9 +++--
2 files cha