From: Ralf Baechle Date: Mon, 10 Oct 2005 13:50:36 +0000 (+0100) Subject: [PATCH] sb1250-mac: Ensure 16-byte alignment of the descriptor ring. X-Git-Tag: v2.6.15-rc1~733^2~1^2~34 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04115def6ad7ef51440365b65a7324fcb82d5d1d;p=linux-2.6 [PATCH] sb1250-mac: Ensure 16-byte alignment of the descriptor ring. Signed-off-by: Ralf Baechle drivers/net/sb1250-mac.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 0f828da033..cb4ea41584 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c @@ -750,7 +750,14 @@ static void sbdma_initctx(sbmacdma_t *d, d->sbdma_maxdescr = maxdescr; d->sbdma_dscrtable = (sbdmadscr_t *) - kmalloc(d->sbdma_maxdescr*sizeof(sbdmadscr_t), GFP_KERNEL); + kmalloc((d->sbdma_maxdescr+1)*sizeof(sbdmadscr_t), GFP_KERNEL); + + /* + * The descriptor table must be aligned to at least 16 bytes or the + * MAC will corrupt it. + */ + d->sbdma_dscrtable = (sbdmadscr_t *) + ALIGN((unsigned long)d->sbdma_dscrtable, sizeof(sbdmadscr_t)); memset(d->sbdma_dscrtable,0,d->sbdma_maxdescr*sizeof(sbdmadscr_t));