* [PATCH 0/3] Staging: Correct the argument of sizeof().
@ 2016-03-20 7:11 Sandhya Bankar
2016-03-20 7:12 ` [PATCH 1/3] Staging: rtl8188eu: rtw_efuse: " Sandhya Bankar
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Sandhya Bankar @ 2016-03-20 7:11 UTC (permalink / raw)
To: outreachy-kernel
Correct the argument of sizeof().
Used below coccinelle semantic patch:
@disable sizeof_type_expr@
type T;
T **x;
@@
x =
<+...sizeof(
- T
+ *x
)...+>
Sandhya Bankar (3):
Staging: rtl8188eu: rtw_efuse: Correct the argument of sizeof().
Staging: lustre: rpc: Correct the argument of sizeof().
Staging: lustre: o2iblnd: Correct the argument of sizeof().
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++--
drivers/staging/lustre/lnet/selftest/rpc.c | 2 +-
drivers/staging/rtl8188eu/core/rtw_efuse.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
--
1.8.3.4
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/3] Staging: rtl8188eu: rtw_efuse: Correct the argument of sizeof(). 2016-03-20 7:11 [PATCH 0/3] Staging: Correct the argument of sizeof() Sandhya Bankar @ 2016-03-20 7:12 ` Sandhya Bankar 2016-03-20 7:14 ` [PATCH 2/3] Staging: lustre: rpc: " Sandhya Bankar 2016-03-20 7:17 ` [PATCH 3/3] Staging: lustre: o2iblnd: " Sandhya Bankar 2 siblings, 0 replies; 8+ messages in thread From: Sandhya Bankar @ 2016-03-20 7:12 UTC (permalink / raw) To: outreachy-kernel Correct the argument of sizeof(). Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> --- drivers/staging/rtl8188eu/core/rtw_efuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index 19f11d0..cd64045 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c @@ -107,7 +107,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) if (!efuseTbl) return; - eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); + eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(*eFuseWord)); if (!eFuseWord) { DBG_88E("%s: alloc eFuseWord fail!\n", __func__); goto eFuseWord_failed; -- 1.8.3.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] Staging: lustre: rpc: Correct the argument of sizeof(). 2016-03-20 7:11 [PATCH 0/3] Staging: Correct the argument of sizeof() Sandhya Bankar 2016-03-20 7:12 ` [PATCH 1/3] Staging: rtl8188eu: rtw_efuse: " Sandhya Bankar @ 2016-03-20 7:14 ` Sandhya Bankar 2016-03-20 7:17 ` [PATCH 3/3] Staging: lustre: o2iblnd: " Sandhya Bankar 2 siblings, 0 replies; 8+ messages in thread From: Sandhya Bankar @ 2016-03-20 7:14 UTC (permalink / raw) To: outreachy-kernel Correct the argument of sizeof(). Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> --- drivers/staging/lustre/lnet/selftest/rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 69be7d6..563827c 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -256,7 +256,7 @@ srpc_service_init(struct srpc_service *svc) svc->sv_shuttingdown = 0; svc->sv_cpt_data = cfs_percpt_alloc(lnet_cpt_table(), - sizeof(struct srpc_service_cd)); + sizeof(*svc->sv_cpt_data)); if (!svc->sv_cpt_data) return -ENOMEM; -- 1.8.3.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] Staging: lustre: o2iblnd: Correct the argument of sizeof(). 2016-03-20 7:11 [PATCH 0/3] Staging: Correct the argument of sizeof() Sandhya Bankar 2016-03-20 7:12 ` [PATCH 1/3] Staging: rtl8188eu: rtw_efuse: " Sandhya Bankar 2016-03-20 7:14 ` [PATCH 2/3] Staging: lustre: rpc: " Sandhya Bankar @ 2016-03-20 7:17 ` Sandhya Bankar 2016-03-20 14:31 ` [Outreachy kernel] " Julia Lawall 2 siblings, 1 reply; 8+ messages in thread From: Sandhya Bankar @ 2016-03-20 7:17 UTC (permalink / raw) To: outreachy-kernel Correct the argument of sizeof(). Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 0d32e65..89f9390 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1968,7 +1968,7 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) */ net->ibn_fmr_ps = cfs_percpt_alloc(lnet_cpt_table(), - sizeof(kib_fmr_poolset_t)); + sizeof(*net->ibn_fmr_ps)); if (!net->ibn_fmr_ps) { CERROR("Failed to allocate FMR pool array\n"); rc = -ENOMEM; @@ -1992,7 +1992,7 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) create_tx_pool: net->ibn_tx_ps = cfs_percpt_alloc(lnet_cpt_table(), - sizeof(kib_tx_poolset_t)); + sizeof(*net->ibn_tx_ps)); if (!net->ibn_tx_ps) { CERROR("Failed to allocate tx pool array\n"); rc = -ENOMEM; -- 1.8.3.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Outreachy kernel] [PATCH 3/3] Staging: lustre: o2iblnd: Correct the argument of sizeof(). 2016-03-20 7:17 ` [PATCH 3/3] Staging: lustre: o2iblnd: " Sandhya Bankar @ 2016-03-20 14:31 ` Julia Lawall [not found] ` <CAA3ASzk+Q7sywUpFqU6KekhHyGRZCAz63osZTGbJ5P+xYs2ifA@mail.gmail.com> 0 siblings, 1 reply; 8+ messages in thread From: Julia Lawall @ 2016-03-20 14:31 UTC (permalink / raw) To: Sandhya Bankar; +Cc: outreachy-kernel On Sun, 20 Mar 2016, Sandhya Bankar wrote: > Correct the argument of sizeof(). What do you mean by correct? Was the value wrong before, ie 27 when it should have been 45? Or is it a coding style issue, ie *x instead of a type name? julia > > Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> > --- > drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > index 0d32e65..89f9390 100644 > --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > @@ -1968,7 +1968,7 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) > */ > > net->ibn_fmr_ps = cfs_percpt_alloc(lnet_cpt_table(), > - sizeof(kib_fmr_poolset_t)); > + sizeof(*net->ibn_fmr_ps)); > if (!net->ibn_fmr_ps) { > CERROR("Failed to allocate FMR pool array\n"); > rc = -ENOMEM; > @@ -1992,7 +1992,7 @@ static int kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) > > create_tx_pool: > net->ibn_tx_ps = cfs_percpt_alloc(lnet_cpt_table(), > - sizeof(kib_tx_poolset_t)); > + sizeof(*net->ibn_tx_ps)); > if (!net->ibn_tx_ps) { > CERROR("Failed to allocate tx pool array\n"); > rc = -ENOMEM; > -- > 1.8.3.4 > > -- > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com. > To post to this group, send email to outreachy-kernel@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/ed2d6f01c194ec9700dcec61409dc30e892136ad.1458454678.git.bankarsandhya512%40gmail.com. > For more options, visit https://groups.google.com/d/optout. > ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CAA3ASzk+Q7sywUpFqU6KekhHyGRZCAz63osZTGbJ5P+xYs2ifA@mail.gmail.com>]
[parent not found: <alpine.DEB.2.10.1603201633370.2597@hadrien>]
* Re: [Outreachy kernel] [PATCH 3/3] Staging: lustre: o2iblnd: Correct the argument of sizeof(). [not found] ` <alpine.DEB.2.10.1603201633370.2597@hadrien> @ 2016-03-20 15:45 ` sandhya bankar 2016-03-20 15:51 ` Julia Lawall 0 siblings, 1 reply; 8+ messages in thread From: sandhya bankar @ 2016-03-20 15:45 UTC (permalink / raw) To: Julia Lawall, outreachy-kernel [-- Attachment #1: Type: text/plain, Size: 3952 bytes --] To prepare this patch i have used following cocci file. Description mentioned below: @disable sizeof_type_expr@ type T; T **x; @@ x = <+...sizeof( - T + *x )...+> whose description is as below: badty/badty.cocci - Correct the size argument to kzalloc obj has type struct snmp_object **, not struct snmp_object *. But indeed it is not even clear why kmalloc is needed. The memory is freed by the end of the function, so the local variable of pointer type should be sufficient. that's why i have used "Correct" word in heading. Please let me know if patch v2 is required with different heading? Thanks, Sandhya On Sun, Mar 20, 2016 at 9:03 PM, Julia Lawall <julia.lawall@lip6.fr> wrote: > > > On Sun, 20 Mar 2016, sandhya bankar wrote: > > > > > Yes.It is coding style issue. > > > > I have read following description: > > > > badty/badty.cocci - Correct the size argument to kzalloc > > obj has type struct snmp_object **, not struct snmp_object *. But > > indeed > > it is not even clear why kmalloc is needed. The memory is freed by > the > > end > > of the function, so the local variable of pointer type should be > > sufficient > > > > what it would be for patch v2? > > Sorry, but I don't understand the above at all. > > julia > > > > > > > > > Thanks, > > Sandhya > > > > On Sun, Mar 20, 2016 at 8:01 PM, Julia Lawall <julia.lawall@lip6.fr> > wrote: > > On Sun, 20 Mar 2016, Sandhya Bankar wrote: > > > > > Correct the argument of sizeof(). > > > > What do you mean by correct? Was the value wrong before, ie 27 > > when it > > should have been 45? Or is it a coding style issue, ie *x > > instead of a > > type name? > > > > julia > > > > > > > > Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> > > > --- > > > drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git > > a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > > b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > > > index 0d32e65..89f9390 100644 > > > --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > > > +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c > > > @@ -1968,7 +1968,7 @@ static int > > kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) > > > */ > > > > > > net->ibn_fmr_ps = cfs_percpt_alloc(lnet_cpt_table(), > > > - > > sizeof(kib_fmr_poolset_t)); > > > + > > sizeof(*net->ibn_fmr_ps)); > > > if (!net->ibn_fmr_ps) { > > > CERROR("Failed to allocate FMR pool array\n"); > > > rc = -ENOMEM; > > > @@ -1992,7 +1992,7 @@ static int > > kiblnd_net_init_pools(kib_net_t *net, __u32 *cpts, int ncpts) > > > > > > create_tx_pool: > > > net->ibn_tx_ps = cfs_percpt_alloc(lnet_cpt_table(), > > > - > > sizeof(kib_tx_poolset_t)); > > > + > > sizeof(*net->ibn_tx_ps)); > > > if (!net->ibn_tx_ps) { > > > CERROR("Failed to allocate tx pool array\n"); > > > rc = -ENOMEM; > > > -- > > > 1.8.3.4 > > > > > > -- > > > You received this message because you are subscribed to the Google > > Groups "outreachy-kernel" group. > > > To unsubscribe from this group and stop receiving emails from it, > > send an email to outreachy-kernel+unsubscribe@googlegroups.com. > > > To post to this group, send email to > > outreachy-kernel@googlegroups.com. > > > To view this discussion on the web visithttps:// > groups.google.com/d/msgid/outreachy-kernel/ed2d6f01c194ec9700dcec61 > > 409dc30e892136ad.1458454678.git.bankarsandhya512%40gmail.com. > > > For more options, visit https://groups.google.com/d/optout. > > > > > > > > > > > > [-- Attachment #2: Type: text/html, Size: 6272 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Outreachy kernel] [PATCH 3/3] Staging: lustre: o2iblnd: Correct the argument of sizeof(). 2016-03-20 15:45 ` sandhya bankar @ 2016-03-20 15:51 ` Julia Lawall 2016-03-20 15:58 ` sandhya bankar 0 siblings, 1 reply; 8+ messages in thread From: Julia Lawall @ 2016-03-20 15:51 UTC (permalink / raw) To: sandhya bankar; +Cc: outreachy-kernel [-- Attachment #1: Type: TEXT/PLAIN, Size: 1071 bytes --] On Sun, 20 Mar 2016, sandhya bankar wrote: > To prepare this patch i have used following cocci file. > Description mentioned below: > > @disable sizeof_type_expr@ > type T; > T **x; > @@ > > x = > <+...sizeof( > - T > + *x > )...+> > > whose description is as below: > > badty/badty.cocci - Correct the size argument to kzalloc > > obj has type struct snmp_object **, not struct snmp_object *. But > indeed > it is not even clear why kmalloc is needed. The memory is freed by the > end > of the function, so the local variable of pointer type should be > sufficient. > > that's why i have used "Correct" word in heading. > Please let me know if patch v2 is required with different heading? You need to understand what the semantic patch is doing, and explain what the transformed code does and why it is wrong. I guess that this semantic patch comes from coccinellery. The descriptions there are autogenerated from a patch that uses the given semantic patch. In this case, the coccinellery description is not useful. julia ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Outreachy kernel] [PATCH 3/3] Staging: lustre: o2iblnd: Correct the argument of sizeof(). 2016-03-20 15:51 ` Julia Lawall @ 2016-03-20 15:58 ` sandhya bankar 0 siblings, 0 replies; 8+ messages in thread From: sandhya bankar @ 2016-03-20 15:58 UTC (permalink / raw) To: Julia Lawall; +Cc: outreachy-kernel [-- Attachment #1: Type: text/plain, Size: 1247 bytes --] Thanks..!! I got it.I will send patch v2. On Sun, Mar 20, 2016 at 9:21 PM, Julia Lawall <julia.lawall@lip6.fr> wrote: > > > On Sun, 20 Mar 2016, sandhya bankar wrote: > > > To prepare this patch i have used following cocci file. > > Description mentioned below: > > > > @disable sizeof_type_expr@ > > type T; > > T **x; > > @@ > > > > x = > > <+...sizeof( > > - T > > + *x > > )...+> > > > > whose description is as below: > > > > badty/badty.cocci - Correct the size argument to kzalloc > > > > obj has type struct snmp_object **, not struct snmp_object *. But > > indeed > > it is not even clear why kmalloc is needed. The memory is freed by > the > > end > > of the function, so the local variable of pointer type should be > > sufficient. > > > > that's why i have used "Correct" word in heading. > > Please let me know if patch v2 is required with different heading? > > You need to understand what the semantic patch is doing, and explain what > the transformed code does and why it is wrong. I guess that this > semantic patch comes from coccinellery. The descriptions there are > autogenerated from a patch that uses the given semantic patch. In this > case, the coccinellery description is not useful. > > julia [-- Attachment #2: Type: text/html, Size: 1885 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-03-20 15:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-20 7:11 [PATCH 0/3] Staging: Correct the argument of sizeof() Sandhya Bankar
2016-03-20 7:12 ` [PATCH 1/3] Staging: rtl8188eu: rtw_efuse: " Sandhya Bankar
2016-03-20 7:14 ` [PATCH 2/3] Staging: lustre: rpc: " Sandhya Bankar
2016-03-20 7:17 ` [PATCH 3/3] Staging: lustre: o2iblnd: " Sandhya Bankar
2016-03-20 14:31 ` [Outreachy kernel] " Julia Lawall
[not found] ` <CAA3ASzk+Q7sywUpFqU6KekhHyGRZCAz63osZTGbJ5P+xYs2ifA@mail.gmail.com>
[not found] ` <alpine.DEB.2.10.1603201633370.2597@hadrien>
2016-03-20 15:45 ` sandhya bankar
2016-03-20 15:51 ` Julia Lawall
2016-03-20 15:58 ` sandhya bankar
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.