From: Andrew Lunn <andrew@lunn.ch>
To: Josh Coombs <josh.coombs@gmail.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
linux ARM <linux-arm-kernel@lists.infradead.org>,
wlanfae@realtek.com, Larry.Finger@lwfinger.net,
florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Andrew Lunn <andrew@lunn.ch>
Subject: Re: [Patch v1 1/1] RTL8712 alignment bug in 3.6.5 on ARM
Date: Sun, 18 Nov 2012 19:20:49 +0100 [thread overview]
Message-ID: <20121118182049.GE14643@lunn.ch> (raw)
In-Reply-To: <CAMW5Ufb9D+BYGtZUWPBWKMtk11QMpR1N+2Q1yb4w_GdvV17p+w@mail.gmail.com>
> >> diff -ruN a/drivers/staging/rtl8712/rtl871x_sta_mgt.c
> >> b/drivers/staging/rtl8712/rtl871x_sta_mgt.c
> >> --- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c 2012-11-05
> >> 03:57:06.000000000 -0500
> >> +++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c 2012-11-13
> >> 12:54:28.000000000 -0500
> >> @@ -55,8 +55,8 @@
> >> NUM_STA + 4);
> >> if (pstapriv->pallocated_stainfo_buf == NULL)
> >> return _FAIL;
> >> - pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
> >> - ((addr_t)(pstapriv->pallocated_stainfo_buf) & 3);
> >> + pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 8 -
> >> + ((addr_t)(pstapriv->pallocated_stainfo_buf) & 7);
> >
> > Are you sure this is safe? Is the allocated buffer large enough for
> > those additional 4 bytes of alignment you're adding?
>
> I'm not certain on that, I bumped the allocations at Andrew's
> suggestion, but don't know enough to certify the changes as 100%
> correct.
Its not correct.
The original code is:
pstapriv->pallocated_stainfo_buf = _malloc(sizeof(struct sta_info) *
NUM_STA + 4);
if (pstapriv->pallocated_stainfo_buf == NULL)
return _FAIL;
pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
((addr_t)(pstapriv->pallocated_stainfo_buf) & 3);
The 4 in the _malloc() also needs increasing to 8.
Andrew
next prev parent reply other threads:[~2012-11-18 18:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-18 17:06 Josh Coombs
2012-11-18 17:47 ` Russell King - ARM Linux
2012-11-18 18:03 ` Josh Coombs
2012-11-18 18:20 ` Andrew Lunn [this message]
2012-11-18 20:10 ` Josh Coombs
2012-11-19 3:37 ` Josh Coombs
2012-11-18 18:11 ` Andrew Lunn
2012-11-18 20:18 ` Larry Finger
2012-11-18 20:55 ` Andrew Lunn
2012-11-19 0:10 ` Larry Finger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121118182049.GE14643@lunn.ch \
--to=andrew@lunn.ch \
--cc=Larry.Finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=josh.coombs@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=wlanfae@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome