From 19124a34f31235c1bb6f0389112f2408f15e1f02 Mon Sep 17 00:00:00 2001 From: zwelch Date: Wed, 27 May 2009 23:54:16 +0000 Subject: Fix potentialyl unaligned memory accesses in mflash driver. git-svn-id: svn://svn.berlios.de/openocd/trunk@1935 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/flash/mflash.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/flash/mflash.c b/src/flash/mflash.c index f2cfd4a1..47c73382 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -1126,8 +1126,9 @@ static int mg_set_pll(mg_pll_t *pll) u8 buff[512]; memset(buff, 0xff, 512); - *((u32 *)&buff[0]) = pll->lock_cyc; /* PLL Lock cycle */ - *((u16 *)&buff[4]) = pll->feedback_div; /* PLL Feedback 9bit Divider */ + /* PLL Lock cycle and Feedback 9bit Divider */ + memcpy(buff, &pll->lock_cyc, sizeof(u32)); + memcpy(buff + 4, &pll->feedback_div, sizeof(u16)); buff[6] = pll->input_div; /* PLL Input 5bit Divider */ buff[7] = pll->output_div; /* PLL Output Divider */ -- cgit v1.2.3