2013-03-14 14:06:47

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH] xtensa: net: fix invalid use of sizeof in iss_net_setup()

From: Wei Yongjun <[email protected]>

sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Signed-off-by: Wei Yongjun <[email protected]>
---
arch/xtensa/platforms/iss/network.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 7d0fea6..da56fec 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -737,7 +737,7 @@ static int iss_net_setup(char *str)
return 1;
}

- if ((new = alloc_bootmem(sizeof new)) == NULL) {
+ if ((new = alloc_bootmem(sizeof(*new)) == NULL) {
printk("Alloc_bootmem failed\n");
return 1;
}


2013-03-15 03:02:55

by Max Filippov

[permalink] [raw]
Subject: Re: [PATCH] xtensa: net: fix invalid use of sizeof in iss_net_setup()

On Thu, Mar 14, 2013 at 6:06 PM, Wei Yongjun <[email protected]> wrote:
> From: Wei Yongjun <[email protected]>
>
> sizeof() when applied to a pointer typed expression gives the
> size of the pointer, not that of the pointed data.
>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> arch/xtensa/platforms/iss/network.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Max Filippov <[email protected]>

--
Thanks.
-- Max