* Re: [PATCH 1/10] MIPS: BCM47XX: Cocci spatch "noderef"
2013-09-19 21:45 ` [PATCH 1/10] MIPS: BCM47XX: " Thomas Meyer
@ 2013-09-19 21:08 ` Hauke Mehrtens
0 siblings, 0 replies; 18+ messages in thread
From: Hauke Mehrtens @ 2013-09-19 21:08 UTC (permalink / raw)
To: thomas, linux-mips, linux-kernel
On 09/19/2013 08:38 PM, thomas@m3y3r.de wrote:
> sizeof when applied to a pointer typed expression gives the size of the
> pointer.
> Found by coccinelle spatch "misc/noderef.cocci"
Thanks for spotting this.
Is this a new rule or has just nobody checked that part of the kernel?
The from field in the mail is broken.
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
> diff -u -p a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
> --- a/arch/mips/bcm47xx/sprom.c
> +++ b/arch/mips/bcm47xx/sprom.c
> @@ -162,7 +162,7 @@ static void nvram_read_alpha2(const char
> pr_warn("alpha2 is too long %s\n", buf);
> return;
> }
> - memcpy(val, buf, sizeof(val));
> + memcpy(val, buf, sizeof(*val));
> }
>
> static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/10] iio: at91_adc: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
2013-09-19 21:42 ` [PATCH 2/10] xtensa: Cocci spatch "noderef" Thomas Meyer
@ 2013-09-19 21:42 ` Thomas Meyer
2013-09-20 7:26 ` Nicolas Ferre
2013-09-19 21:45 ` [PATCH 8/10] staging: r8188eu: Add files for new drive: " Thomas Meyer
` (6 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:42 UTC (permalink / raw)
To: jic23, grant.likely, rob.herring, linux-iio, linux-kernel,
devicetree
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -279,7 +279,7 @@ static int at91_adc_trigger_init(struct
int i, ret;
st->trig = devm_kzalloc(&idev->dev,
- st->trigger_number * sizeof(st->trig),
+ st->trigger_number * sizeof(*st->trig),
GFP_KERNEL);
if (st->trig == NULL) {
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/10] xtensa: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
@ 2013-09-19 21:42 ` Thomas Meyer
2013-09-19 22:10 ` Joe Perches
2013-09-19 21:42 ` [PATCH 3/10] iio: at91_adc: " Thomas Meyer
` (7 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:42 UTC (permalink / raw)
To: chris, jcmvbkbc, linux-xtensa, linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -737,7 +737,7 @@ static int __init iss_net_setup(char *st
return 1;
}
- if ((new = alloc_bootmem(sizeof new)) == NULL) {
+ if ((new = alloc_bootmem(sizeof *new)) == NULL) {
printk("Alloc_bootmem failed\n");
return 1;
}
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 6/10] staging: octeon-usb: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
` (6 preceding siblings ...)
2013-09-19 21:45 ` [PATCH 1/10] MIPS: BCM47XX: " Thomas Meyer
@ 2013-09-19 21:45 ` Thomas Meyer
2013-09-19 21:45 ` [PATCH 4/10] [SCSI] csiostor: " Thomas Meyer
8 siblings, 0 replies; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:45 UTC (permalink / raw)
To: devel, linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/staging/octeon-usb/cvmx-usb.c b/drivers/staging/octeon-usb/cvmx-usb.c
--- a/drivers/staging/octeon-usb/cvmx-usb.c
+++ b/drivers/staging/octeon-usb/cvmx-usb.c
@@ -604,7 +604,7 @@ int cvmx_usb_initialize(struct cvmx_usb_
}
}
- memset(usb, 0, sizeof(usb));
+ memset(usb, 0, sizeof(*usb));
usb->init_flags = flags;
/* Initialize the USB state structure */
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 9/10] staging: r8188eu: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
` (3 preceding siblings ...)
2013-09-19 21:45 ` [PATCH 5/10] staging: lustre: " Thomas Meyer
@ 2013-09-19 21:45 ` Thomas Meyer
2013-09-20 10:44 ` Dan Carpenter
2013-09-19 21:45 ` [PATCH 7/10] staging: r8188eu: Add files for new drive: " Thomas Meyer
` (3 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:45 UTC (permalink / raw)
To: devel, linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -6973,7 +6973,7 @@ static int rtw_mp_ctx(struct net_device
stop = strncmp(extra, "stop", 4);
sscanf(extra, "count =%d, pkt", &count);
- _rtw_memset(extra, '\0', sizeof(extra));
+ _rtw_memset(extra, '\0', sizeof(*extra));
if (stop == 0) {
bStartTest = 0; /* To set Stop */
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 8/10] staging: r8188eu: Add files for new drive: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
2013-09-19 21:42 ` [PATCH 2/10] xtensa: Cocci spatch "noderef" Thomas Meyer
2013-09-19 21:42 ` [PATCH 3/10] iio: at91_adc: " Thomas Meyer
@ 2013-09-19 21:45 ` Thomas Meyer
2013-09-19 21:45 ` [PATCH 5/10] staging: lustre: " Thomas Meyer
` (5 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:45 UTC (permalink / raw)
To: devel, linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
@@ -57,7 +57,7 @@ static void Init_ODM_ComInfo_88E(struct
u8 cut_ver, fab_ver;
/* Init Value */
- _rtw_memset(dm_odm, 0, sizeof(dm_odm));
+ _rtw_memset(dm_odm, 0, sizeof(*dm_odm));
dm_odm->Adapter = Adapter;
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 5/10] staging: lustre: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
` (2 preceding siblings ...)
2013-09-19 21:45 ` [PATCH 8/10] staging: r8188eu: Add files for new drive: " Thomas Meyer
@ 2013-09-19 21:45 ` Thomas Meyer
2013-09-19 21:45 ` [PATCH 9/10] staging: r8188eu: " Thomas Meyer
` (4 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:45 UTC (permalink / raw)
To: devel, linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -1387,7 +1387,7 @@ echo_copyout_lsm (struct lov_stripe_md *
if (nob > ulsm_nob)
return (-EINVAL);
- if (copy_to_user (ulsm, lsm, sizeof(ulsm)))
+ if (copy_to_user (ulsm, lsm, sizeof(*ulsm)))
return (-EFAULT);
for (i = 0; i < lsm->lsm_stripe_count; i++) {
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 4/10] [SCSI] csiostor: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
` (7 preceding siblings ...)
2013-09-19 21:45 ` [PATCH 6/10] staging: octeon-usb: " Thomas Meyer
@ 2013-09-19 21:45 ` Thomas Meyer
8 siblings, 0 replies; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:45 UTC (permalink / raw)
To: JBottomley, linux-scsi, linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c
--- a/drivers/scsi/csiostor/csio_mb.c
+++ b/drivers/scsi/csiostor/csio_mb.c
@@ -1531,7 +1531,7 @@ csio_mb_isr_handler(struct csio_hw *hw)
* Enqueue event to EventQ. Events processing happens
* in Event worker thread context
*/
- if (csio_enqueue_evt(hw, CSIO_EVT_MBX, mbp, sizeof(mbp)))
+ if (csio_enqueue_evt(hw, CSIO_EVT_MBX, mbp, sizeof(*mbp)))
CSIO_INC_STATS(hw, n_evt_drop);
return 0;
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 7/10] staging: r8188eu: Add files for new drive: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
` (4 preceding siblings ...)
2013-09-19 21:45 ` [PATCH 9/10] staging: r8188eu: " Thomas Meyer
@ 2013-09-19 21:45 ` Thomas Meyer
2013-09-20 10:43 ` Dan Carpenter
2013-09-19 21:45 ` [PATCH 1/10] MIPS: BCM47XX: " Thomas Meyer
` (2 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:45 UTC (permalink / raw)
To: devel, linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/staging/rtl8188eu/core/rtw_mp.c b/drivers/staging/rtl8188eu/core/rtw_mp.c
--- a/drivers/staging/rtl8188eu/core/rtw_mp.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mp.c
@@ -907,7 +907,7 @@ u32 mp_query_psd(struct adapter *pAdapte
sscanf(data, "pts =%d, start =%d, stop =%d", &psd_pts, &psd_start, &psd_stop);
}
- _rtw_memset(data, '\0', sizeof(data));
+ _rtw_memset(data, '\0', sizeof(*data));
i = psd_start;
while (i < psd_stop) {
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/10] MIPS: BCM47XX: Cocci spatch "noderef"
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
` (5 preceding siblings ...)
2013-09-19 21:45 ` [PATCH 7/10] staging: r8188eu: Add files for new drive: " Thomas Meyer
@ 2013-09-19 21:45 ` Thomas Meyer
2013-09-19 21:08 ` Hauke Mehrtens
2013-09-19 21:45 ` [PATCH 6/10] staging: octeon-usb: " Thomas Meyer
2013-09-19 21:45 ` [PATCH 4/10] [SCSI] csiostor: " Thomas Meyer
8 siblings, 1 reply; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:45 UTC (permalink / raw)
To: linux-mips, linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
--- a/arch/mips/bcm47xx/sprom.c
+++ b/arch/mips/bcm47xx/sprom.c
@@ -162,7 +162,7 @@ static void nvram_read_alpha2(const char
pr_warn("alpha2 is too long %s\n", buf);
return;
}
- memcpy(val, buf, sizeof(val));
+ memcpy(val, buf, sizeof(*val));
}
static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9
@ 2013-09-19 21:45 Thomas Meyer
2013-09-19 21:42 ` [PATCH 2/10] xtensa: Cocci spatch "noderef" Thomas Meyer
` (8 more replies)
0 siblings, 9 replies; 18+ messages in thread
From: Thomas Meyer @ 2013-09-19 21:45 UTC (permalink / raw)
To: linux-kernel
sizeof when applied to a pointer typed expression gives the size of the
pointer.
Found by coccinelle spatch "misc/noderef.cocci"
Run against version v3.11-7547-g44598f9
Let me know when you as a maintainer are not interested in these kind of patches.
I can exclude you by path; all cocci findings in e.g. "drivers/scsi" will never
be reported again by this semi-automatic cocci program runs.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/10] xtensa: Cocci spatch "noderef"
2013-09-19 21:42 ` [PATCH 2/10] xtensa: Cocci spatch "noderef" Thomas Meyer
@ 2013-09-19 22:10 ` Joe Perches
0 siblings, 0 replies; 18+ messages in thread
From: Joe Perches @ 2013-09-19 22:10 UTC (permalink / raw)
To: Thomas Meyer; +Cc: chris, jcmvbkbc, linux-xtensa, linux-kernel
On Thu, 2013-09-19 at 23:42 +0200, Thomas Meyer wrote:
> sizeof when applied to a pointer typed expression gives the size of the
> pointer.
Hi Thomas, thanks for doing the series...
> diff -u -p a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
[]
> @@ -737,7 +737,7 @@ static int __init iss_net_setup(char *st
> return 1;
> }
>
> - if ((new = alloc_bootmem(sizeof new)) == NULL) {
> + if ((new = alloc_bootmem(sizeof *new)) == NULL) {
sizeof(*new)
Please run coccinelle generated patches through checkpatch
(and the compiler of course) before submitting them.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/10] iio: at91_adc: Cocci spatch "noderef"
2013-09-19 21:42 ` [PATCH 3/10] iio: at91_adc: " Thomas Meyer
@ 2013-09-20 7:26 ` Nicolas Ferre
2013-09-20 18:36 ` Jonathan Cameron
0 siblings, 1 reply; 18+ messages in thread
From: Nicolas Ferre @ 2013-09-20 7:26 UTC (permalink / raw)
To: Thomas Meyer, jic23, grant.likely, rob.herring, linux-iio
Cc: linux-kernel, devicetree
On 19/09/2013 23:42, Thomas Meyer :
> sizeof when applied to a pointer typed expression gives the size of the
> pointer.
> Found by coccinelle spatch "misc/noderef.cocci"
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>
> diff -u -p a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -279,7 +279,7 @@ static int at91_adc_trigger_init(struct
> int i, ret;
>
> st->trig = devm_kzalloc(&idev->dev,
> - st->trigger_number * sizeof(st->trig),
> + st->trigger_number * sizeof(*st->trig),
> GFP_KERNEL);
>
> if (st->trig == NULL) {
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/10] staging: r8188eu: Add files for new drive: Cocci spatch "noderef"
2013-09-19 21:45 ` [PATCH 7/10] staging: r8188eu: Add files for new drive: " Thomas Meyer
@ 2013-09-20 10:43 ` Dan Carpenter
0 siblings, 0 replies; 18+ messages in thread
From: Dan Carpenter @ 2013-09-20 10:43 UTC (permalink / raw)
To: Thomas Meyer; +Cc: devel, linux-kernel
On Thu, Sep 19, 2013 at 11:45:46PM +0200, Thomas Meyer wrote:
> sizeof when applied to a pointer typed expression gives the size of the
> pointer.
> Found by coccinelle spatch "misc/noderef.cocci"
>
When you're writing the changelog for these it helps if you say how
many bytes sizeof(*data) is. In this case, we have gone from clearing 8
bytes to clearing 1 byte so the original code had a potential memory
corruption bug.
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
>
> diff -u -p a/drivers/staging/rtl8188eu/core/rtw_mp.c b/drivers/staging/rtl8188eu/core/rtw_mp.c
> --- a/drivers/staging/rtl8188eu/core/rtw_mp.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_mp.c
> @@ -907,7 +907,7 @@ u32 mp_query_psd(struct adapter *pAdapte
> sscanf(data, "pts =%d, start =%d, stop =%d", &psd_pts, &psd_start, &psd_stop);
> }
>
> - _rtw_memset(data, '\0', sizeof(data));
> + _rtw_memset(data, '\0', sizeof(*data));
I think your fix is correct but it would be better to remove the memset
and do:
data[0] = '\0';
"data" is a u8 pointer, but it should obviously be a char pointer. The
original code here is not high quality. :P
regards,
dan carpenter
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 9/10] staging: r8188eu: Cocci spatch "noderef"
2013-09-19 21:45 ` [PATCH 9/10] staging: r8188eu: " Thomas Meyer
@ 2013-09-20 10:44 ` Dan Carpenter
0 siblings, 0 replies; 18+ messages in thread
From: Dan Carpenter @ 2013-09-20 10:44 UTC (permalink / raw)
To: Thomas Meyer; +Cc: devel, linux-kernel
On Thu, Sep 19, 2013 at 11:45:46PM +0200, Thomas Meyer wrote:
> sizeof when applied to a pointer typed expression gives the size of the
> pointer.
> Found by coccinelle spatch "misc/noderef.cocci"
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
>
> diff -u -p a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> @@ -6973,7 +6973,7 @@ static int rtw_mp_ctx(struct net_device
> stop = strncmp(extra, "stop", 4);
> sscanf(extra, "count =%d, pkt", &count);
>
> - _rtw_memset(extra, '\0', sizeof(extra));
> + _rtw_memset(extra, '\0', sizeof(*extra));
Do:
extra[0] = '\0';
regards,
dan carpenter
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/10] iio: at91_adc: Cocci spatch "noderef"
2013-09-20 7:26 ` Nicolas Ferre
@ 2013-09-20 18:36 ` Jonathan Cameron
2013-09-20 18:42 ` Jonathan Cameron
0 siblings, 1 reply; 18+ messages in thread
From: Jonathan Cameron @ 2013-09-20 18:36 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Thomas Meyer, jic23, grant.likely, rob.herring, linux-iio,
linux-kernel, devicetree
On 09/20/13 08:26, Nicolas Ferre wrote:
> On 19/09/2013 23:42, Thomas Meyer :
>> sizeof when applied to a pointer typed expression gives the size of the
>> pointer.
>> Found by coccinelle spatch "misc/noderef.cocci"
>>
>> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Applied to the fixes-togreg branch of
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
Thanks,
>
>> ---
>>
>> diff -u -p a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
>> --- a/drivers/iio/adc/at91_adc.c
>> +++ b/drivers/iio/adc/at91_adc.c
>> @@ -279,7 +279,7 @@ static int at91_adc_trigger_init(struct
>> int i, ret;
>>
>> st->trig = devm_kzalloc(&idev->dev,
>> - st->trigger_number * sizeof(st->trig),
>> + st->trigger_number * sizeof(*st->trig),
>> GFP_KERNEL);
>>
>> if (st->trig == NULL) {
>> --
>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/10] iio: at91_adc: Cocci spatch "noderef"
2013-09-20 18:36 ` Jonathan Cameron
@ 2013-09-20 18:42 ` Jonathan Cameron
2013-09-23 12:16 ` Nicolas Ferre
0 siblings, 1 reply; 18+ messages in thread
From: Jonathan Cameron @ 2013-09-20 18:42 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Thomas Meyer, jic23, grant.likely, rob.herring, linux-iio,
linux-kernel, devicetree
On 09/20/13 19:36, Jonathan Cameron wrote:
> On 09/20/13 08:26, Nicolas Ferre wrote:
>> On 19/09/2013 23:42, Thomas Meyer :
>>> sizeof when applied to a pointer typed expression gives the size of the
>>> pointer.
>>> Found by coccinelle spatch "misc/noderef.cocci"
>>>
>>> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
>>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Applied to the fixes-togreg branch of
> git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
Actually, change of plan. Applied to the togreg branch of that
tree. Whilst technically more correct to have it as you say,
we are dealing with the size of a struct iio_trig ** vs
a struct iio_trig * so it isn't actually a bug, just a
less than ideal bit of code ;)
It was so obviously a fix I didn't initially check if it
was a 'real' bug or not. oops.
Jonathan
>
> Thanks,
>>
>>> ---
>>>
>>> diff -u -p a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
>>> --- a/drivers/iio/adc/at91_adc.c
>>> +++ b/drivers/iio/adc/at91_adc.c
>>> @@ -279,7 +279,7 @@ static int at91_adc_trigger_init(struct
>>> int i, ret;
>>>
>>> st->trig = devm_kzalloc(&idev->dev,
>>> - st->trigger_number * sizeof(st->trig),
>>> + st->trigger_number * sizeof(*st->trig),
>>> GFP_KERNEL);
>>>
>>> if (st->trig == NULL) {
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>
>>
>>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/10] iio: at91_adc: Cocci spatch "noderef"
2013-09-20 18:42 ` Jonathan Cameron
@ 2013-09-23 12:16 ` Nicolas Ferre
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Ferre @ 2013-09-23 12:16 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Thomas Meyer, jic23, grant.likely, rob.herring, linux-iio,
linux-kernel, devicetree
On 20/09/2013 20:42, Jonathan Cameron :
> On 09/20/13 19:36, Jonathan Cameron wrote:
>> On 09/20/13 08:26, Nicolas Ferre wrote:
>>> On 19/09/2013 23:42, Thomas Meyer :
>>>> sizeof when applied to a pointer typed expression gives the size of the
>>>> pointer.
>>>> Found by coccinelle spatch "misc/noderef.cocci"
>>>>
>>>> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
>>>
>>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Applied to the fixes-togreg branch of
>> git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
>
> Actually, change of plan. Applied to the togreg branch of that
> tree. Whilst technically more correct to have it as you say,
> we are dealing with the size of a struct iio_trig ** vs
> a struct iio_trig * so it isn't actually a bug, just a
> less than ideal bit of code ;)
Absolutely.
> It was so obviously a fix I didn't initially check if it
> was a 'real' bug or not. oops.
Yes, I took this path myself as well ;-)
Bye,
>>>> ---
>>>>
>>>> diff -u -p a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
>>>> --- a/drivers/iio/adc/at91_adc.c
>>>> +++ b/drivers/iio/adc/at91_adc.c
>>>> @@ -279,7 +279,7 @@ static int at91_adc_trigger_init(struct
>>>> int i, ret;
>>>>
>>>> st->trig = devm_kzalloc(&idev->dev,
>>>> - st->trigger_number * sizeof(st->trig),
>>>> + st->trigger_number * sizeof(*st->trig),
>>>> GFP_KERNEL);
>>>>
>>>> if (st->trig == NULL) {
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>>
>>>
>>>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2013-09-23 12:16 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-19 21:45 [PATCH 0/10] Cocci spatch "noderef" - v3.11-7547-g44598f9 Thomas Meyer
2013-09-19 21:42 ` [PATCH 2/10] xtensa: Cocci spatch "noderef" Thomas Meyer
2013-09-19 22:10 ` Joe Perches
2013-09-19 21:42 ` [PATCH 3/10] iio: at91_adc: " Thomas Meyer
2013-09-20 7:26 ` Nicolas Ferre
2013-09-20 18:36 ` Jonathan Cameron
2013-09-20 18:42 ` Jonathan Cameron
2013-09-23 12:16 ` Nicolas Ferre
2013-09-19 21:45 ` [PATCH 8/10] staging: r8188eu: Add files for new drive: " Thomas Meyer
2013-09-19 21:45 ` [PATCH 5/10] staging: lustre: " Thomas Meyer
2013-09-19 21:45 ` [PATCH 9/10] staging: r8188eu: " Thomas Meyer
2013-09-20 10:44 ` Dan Carpenter
2013-09-19 21:45 ` [PATCH 7/10] staging: r8188eu: Add files for new drive: " Thomas Meyer
2013-09-20 10:43 ` Dan Carpenter
2013-09-19 21:45 ` [PATCH 1/10] MIPS: BCM47XX: " Thomas Meyer
2013-09-19 21:08 ` Hauke Mehrtens
2013-09-19 21:45 ` [PATCH 6/10] staging: octeon-usb: " Thomas Meyer
2013-09-19 21:45 ` [PATCH 4/10] [SCSI] csiostor: " Thomas Meyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).