linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] arch/mips/alchemy: Correct code taking the size of a pointer
@ 2009-12-13 11:40 Julia Lawall
  2009-12-14 13:34 ` Help in enabling HIGHMEM support Anoop P.A.
  2009-12-24 13:22 ` [PATCH 1/9] arch/mips/alchemy: Correct code taking the size of a pointer Ralf Baechle
  0 siblings, 2 replies; 12+ messages in thread
From: Julia Lawall @ 2009-12-13 11:40 UTC (permalink / raw)
  To: ralf, linux-mips, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

sizeof(dp) is just the size of the pointer.  Change it to the size of the
referenced structure.

A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression *x;
expression f;
type T;
@@

*f(...,(T)x,...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/mips/alchemy/common/dbdma.c    |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c
index 4851308..40071bd 100644
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@ -612,7 +612,7 @@ u32 au1xxx_dbdma_put_source(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
 	dma_cache_wback_inv((unsigned long)buf, nbytes);
 	dp->dscr_cmd0 |= DSCR_CMD0_V;	/* Let it rip */
 	au_sync();
-	dma_cache_wback_inv((unsigned long)dp, sizeof(dp));
+	dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
 	ctp->chan_ptr->ddma_dbell = 0;
 
 	/* Get next descriptor pointer.	*/
@@ -674,7 +674,7 @@ u32 au1xxx_dbdma_put_dest(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
 	dma_cache_inv((unsigned long)buf, nbytes);
 	dp->dscr_cmd0 |= DSCR_CMD0_V;	/* Let it rip */
 	au_sync();
-	dma_cache_wback_inv((unsigned long)dp, sizeof(dp));
+	dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
 	ctp->chan_ptr->ddma_dbell = 0;
 
 	/* Get next descriptor pointer.	*/

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-01-20 13:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-13 11:40 [PATCH 1/9] arch/mips/alchemy: Correct code taking the size of a pointer Julia Lawall
2009-12-14 13:34 ` Help in enabling HIGHMEM support Anoop P.A.
2009-12-14 13:34   ` Anoop P.A.
2009-12-14 17:35   ` Ralf Baechle
2010-01-18 15:57     ` Help in enabling HIGHMEM support / 64 bit support Anoop P.A.
2010-01-18 15:57       ` Anoop P.A.
2010-01-19 14:55       ` Anoop P.A.
2010-01-19 14:55         ` Anoop P.A.
2010-01-19 15:43       ` Ralf Baechle
2010-01-20 13:03         ` Anoop P.A.
2010-01-20 13:03           ` Anoop P.A.
2009-12-24 13:22 ` [PATCH 1/9] arch/mips/alchemy: Correct code taking the size of a pointer Ralf Baechle

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).