* [PATCH] staging: mt7621-dma: sizeof via pointer dereference
@ 2019-05-30 23:53 Benjamin Sherman
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Sherman @ 2019-05-30 23:53 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Matthias Brugger, devel, linux-arm-kernel, linux-mediatek, linux-kernel
Pass the size of a struct into kzalloc by pointer dereference. This
complies with the Linux kernel coding style and removes the possibility
for a bug if the pointer's type is changed.
Signed-off-by: Benjamin Sherman <benjamin@bensherman.io>
---
drivers/staging/mt7621-dma/mtk-hsdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/mt7621-dma/mtk-hsdma.c b/drivers/staging/mt7621-dma/mtk-hsdma.c
index a58725dd2611..60db06768c8a 100644
--- a/drivers/staging/mt7621-dma/mtk-hsdma.c
+++ b/drivers/staging/mt7621-dma/mtk-hsdma.c
@@ -468,7 +468,7 @@ static struct dma_async_tx_descriptor *mtk_hsdma_prep_dma_memcpy(
if (len <= 0)
return NULL;
- desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC);
+ desc = kzalloc(sizeof(*desc), GFP_ATOMIC);
if (!desc) {
dev_err(c->device->dev, "alloc memcpy decs error\n");
return NULL;
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: mt7621-dma: sizeof via pointer dereference
2019-05-30 21:41 Benjamin Sherman
@ 2019-05-30 21:57 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-30 21:57 UTC (permalink / raw)
To: Benjamin Sherman; +Cc: linux-kernel
On Thu, May 30, 2019 at 09:41:43PM +0000, Benjamin Sherman wrote:
> Pass the size of a struct into kzalloc by pointer dereference. This
> complies with the Linux kernel coding style and removes the possibility
> for a bug when the pointer's type is changed.
>
> Signed-off-by: Benjamin Sherman <benjamin@bensherman.io>
> ---
> This is my first patch, so please forgive any seemingly obvious
> mistakes. I apologize if this is the incorrect mailing list.
> ---
> drivers/staging/mt7621-dma/mtk-hsdma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Can you resend and properly cc: the needed developers and mailing list
that scripts/get_maintainer.pl says to cc:?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] staging: mt7621-dma: sizeof via pointer dereference
@ 2019-05-30 21:41 Benjamin Sherman
2019-05-30 21:57 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Sherman @ 2019-05-30 21:41 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-kernel
Pass the size of a struct into kzalloc by pointer dereference. This
complies with the Linux kernel coding style and removes the possibility
for a bug when the pointer's type is changed.
Signed-off-by: Benjamin Sherman <benjamin@bensherman.io>
---
This is my first patch, so please forgive any seemingly obvious
mistakes. I apologize if this is the incorrect mailing list.
---
drivers/staging/mt7621-dma/mtk-hsdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/mt7621-dma/mtk-hsdma.c b/drivers/staging/mt7621-dma/mtk-hsdma.c
index a58725dd2611..60db06768c8a 100644
--- a/drivers/staging/mt7621-dma/mtk-hsdma.c
+++ b/drivers/staging/mt7621-dma/mtk-hsdma.c
@@ -468,7 +468,7 @@ static struct dma_async_tx_descriptor *mtk_hsdma_prep_dma_memcpy(
if (len <= 0)
return NULL;
- desc = kzalloc(sizeof(struct mtk_hsdma_desc), GFP_ATOMIC);
+ desc = kzalloc(sizeof(*desc), GFP_ATOMIC);
if (!desc) {
dev_err(c->device->dev, "alloc memcpy decs error\n");
return NULL;
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-31 0:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-30 23:53 [PATCH] staging: mt7621-dma: sizeof via pointer dereference Benjamin Sherman
-- strict thread matches above, loose matches on Subject: below --
2019-05-30 21:41 Benjamin Sherman
2019-05-30 21:57 ` Greg Kroah-Hartman
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).