Re: [PATCH 2/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-20 Thread walter harms


Am 18.05.2014 19:27, schrieb Joe Perches:
> On Sun, 2014-05-18 at 18:19 +0100, Masaru Nomura wrote:
>> Remove prohibited space and fix line over 80 characters of
>> memset(...) to meet kernel coding style.
> []
>> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
>> b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
> []
>> @@ -113,7 +113,7 @@ ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t 
>> *ni, lnet_process_id_t id)
>>  if (peer == NULL)
>>  return -ENOMEM;
>>  
>> -memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
>> etc */
>> +memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */
> 
> It looks like this memset is unnecessary
> as it's already zeroed by LIBCFS_ALLOC->
> LIBCFS_ALLOC_GFP->LIBCFS_ALLOC_POST->memset.
> 
> It seems as if all these ALLOC macros could
> use quite a bit of cleaning/sorting out.
> 

for a start,
some kind soul could replace the malloc()/memset() with zalloc().

re,
 wh





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-20 Thread walter harms


Am 18.05.2014 19:27, schrieb Joe Perches:
 On Sun, 2014-05-18 at 18:19 +0100, Masaru Nomura wrote:
 Remove prohibited space and fix line over 80 characters of
 memset(...) to meet kernel coding style.
 []
 diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
 b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
 []
 @@ -113,7 +113,7 @@ ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t 
 *ni, lnet_process_id_t id)
  if (peer == NULL)
  return -ENOMEM;
  
 -memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
 etc */
 +memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */
 
 It looks like this memset is unnecessary
 as it's already zeroed by LIBCFS_ALLOC-
 LIBCFS_ALLOC_GFP-LIBCFS_ALLOC_POST-memset.
 
 It seems as if all these ALLOC macros could
 use quite a bit of cleaning/sorting out.
 

for a start,
some kind soul could replace the malloc()/memset() with zalloc().

re,
 wh





--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-18 Thread Masaru Nomura
>> - memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
>> etc */
>> + memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */
>
> It looks like this memset is unnecessary
> as it's already zeroed by LIBCFS_ALLOC->
> LIBCFS_ALLOC_GFP->LIBCFS_ALLOC_POST->memset.
>
> It seems as if all these ALLOC macros could
> use quite a bit of cleaning/sorting out.

Thank you for pointing it out. I didn't know that nor check the macros.
I'll care about similar problems next time.

I checked the macros and kind of understand what you mean,
but honestly I'm not sure whether or not it's perfectly correct to
remove memset.

If this is the right way, I think we can remove the following memset
which I modified as well.
The reason is the same as you mentioned. conn is zeroed by
LIBCFS_ALLOC before memset.

[PATCH 1/5]
@@ -1041,26 +1041,26 @@ ksocknal_create_conn (lnet_ni_t *ni,
ksock_route_t *route,
goto failed_0;
}

-   memset (conn, 0, sizeof (*conn));
+   memset(conn, 0, sizeof(*conn));


Thank you,
Masaru
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-18 Thread Joe Perches
On Sun, 2014-05-18 at 18:19 +0100, Masaru Nomura wrote:
> Remove prohibited space and fix line over 80 characters of
> memset(...) to meet kernel coding style.
[]
> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
> b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
[]
> @@ -113,7 +113,7 @@ ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, 
> lnet_process_id_t id)
>   if (peer == NULL)
>   return -ENOMEM;
>  
> - memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
> etc */
> + memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */

It looks like this memset is unnecessary
as it's already zeroed by LIBCFS_ALLOC->
LIBCFS_ALLOC_GFP->LIBCFS_ALLOC_POST->memset.

It seems as if all these ALLOC macros could
use quite a bit of cleaning/sorting out.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-18 Thread Joe Perches
On Sun, 2014-05-18 at 18:19 +0100, Masaru Nomura wrote:
 Remove prohibited space and fix line over 80 characters of
 memset(...) to meet kernel coding style.
[]
 diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
 b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
[]
 @@ -113,7 +113,7 @@ ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, 
 lnet_process_id_t id)
   if (peer == NULL)
   return -ENOMEM;
  
 - memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
 etc */
 + memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */

It looks like this memset is unnecessary
as it's already zeroed by LIBCFS_ALLOC-
LIBCFS_ALLOC_GFP-LIBCFS_ALLOC_POST-memset.

It seems as if all these ALLOC macros could
use quite a bit of cleaning/sorting out.


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-18 Thread Masaru Nomura
 - memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
 etc */
 + memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */

 It looks like this memset is unnecessary
 as it's already zeroed by LIBCFS_ALLOC-
 LIBCFS_ALLOC_GFP-LIBCFS_ALLOC_POST-memset.

 It seems as if all these ALLOC macros could
 use quite a bit of cleaning/sorting out.

Thank you for pointing it out. I didn't know that nor check the macros.
I'll care about similar problems next time.

I checked the macros and kind of understand what you mean,
but honestly I'm not sure whether or not it's perfectly correct to
remove memset.

If this is the right way, I think we can remove the following memset
which I modified as well.
The reason is the same as you mentioned. conn is zeroed by
LIBCFS_ALLOC before memset.

[PATCH 1/5]
@@ -1041,26 +1041,26 @@ ksocknal_create_conn (lnet_ni_t *ni,
ksock_route_t *route,
goto failed_0;
}

-   memset (conn, 0, sizeof (*conn));
+   memset(conn, 0, sizeof(*conn));


Thank you,
Masaru
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/