From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
Date: Mon, 18 May 2015 12:09:18 +0300 [thread overview]
Message-ID: <20150518090918.GG22558@mwanda> (raw)
In-Reply-To: <5558FC58.4040407@gmail.com>
On Sun, May 17, 2015 at 10:38:48PM +0200, Mateusz Kulikowski wrote:
> On 15.05.2015 01:14, Dan Carpenter wrote:
> > On Thu, May 14, 2015 at 10:29:39PM +0200, Mateusz Kulikowski wrote:
> >> On 13.05.2015 10:22, Dan Carpenter wrote:
> >>> On Tue, May 12, 2015 at 10:00:13PM +0200, Mateusz Kulikowski wrote:
> >>>> On 11.05.2015 10:26, Dan Carpenter wrote:
> >> (...)
> >>>>>
> >>>>> Which part isn't aligned? I think they both are.
> >>>>>
> >>>> struct rtllib_rxb *prxb = prxbIndicateArray[j];
> >>>>
> >>>> struct rtllib_rxb {
> >>>> u8 nr_subframes;
> >>>> struct sk_buff *subframes[MAX_SUBFRAME_COUNT == 64];
> >>>> u8 dst[ETH_ALEN]; // here
> >>>> u8 src[ETH_ALEN]; // here
> >>>> } __packed;
> (...)
> >
> > I'm not positive it's "by design" though, this is staging code so maybe
> > they just added __packed to every struct. In fact, I'm pretty sure
> > unaligned pointers don't work on some arches so the __packed is probably
> > a bug.
> >
>
> I doubt anyone uses it on anything else than some low cost x86 netbooks.
>
Generally though, there shouldn't be pointers in __packed structs.
__packed means we care about alignment very much, probably more than we
care about speed. So it means we are sharing the data with the hardware
or with userspace which requires a specific layout. We shouldn't be
giving kernel pointers to userspace or the hardware. (These are rules
of thumb).
> I removed __packed and did a small test today (download 10mb of garbage, check md5)
> - it doesn't seem to affect driver (on staging-testing, without this patchset).
>
> Nevertheless I would prefer to leave it like that for this patch set if it's
> OK with you and perhaps include it for next series I'll work on.
I think Greg asked for a v4 of this patchset? You can leave the code
as is if you want. :) You didn't introduce the bug and I'm not your
boss. :P
regards,
dan carpenter
next prev parent reply other threads:[~2015-05-18 9:09 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-09 21:18 [PATCH v3 00/33] staging: rtl8192e: Fix more checkpatch.pl warnings Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 01/33] staging: rtl8192e: Declare ethernet addresses as __aligned(2) Mateusz Kulikowski
2015-05-09 22:29 ` Joe Perches
2015-05-12 19:44 ` Mateusz Kulikowski
2015-05-12 19:53 ` Joe Perches
2015-05-09 21:18 ` [PATCH v3 02/33] staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings Mateusz Kulikowski
2015-05-10 13:19 ` Greg KH
2015-05-12 19:52 ` Mateusz Kulikowski
2015-05-12 21:19 ` Greg KH
2015-05-14 20:22 ` Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy() Mateusz Kulikowski
2015-05-10 13:20 ` Greg KH
2015-05-12 20:05 ` Mateusz Kulikowski
2015-05-11 8:26 ` Dan Carpenter
2015-05-12 20:00 ` Mateusz Kulikowski
2015-05-13 8:22 ` Dan Carpenter
2015-05-14 20:29 ` Mateusz Kulikowski
2015-05-14 23:14 ` Dan Carpenter
2015-05-17 20:38 ` Mateusz Kulikowski
2015-05-18 9:09 ` Dan Carpenter [this message]
2015-05-09 21:18 ` [PATCH v3 04/33] staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param() Mateusz Kulikowski
2015-05-10 7:49 ` Sudip Mukherjee
2015-05-12 21:01 ` Mateusz Kulikowski
2015-05-13 4:45 ` Sudip Mukherjee
2015-05-13 8:26 ` Dan Carpenter
2015-05-11 13:48 ` Dan Carpenter
2015-05-12 20:46 ` Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 05/33] staging: rtl8192e: Replace memcmp() with ether_addr_equal_unaligned() Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 06/33] staging: rtl8192e: Remove rtllib_crypt.[ch] Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 07/33] staging: rtl8192e: Replace RTLLIB_DEBUG(DL_ERR) with netdev_*() Mateusz Kulikowski
2015-05-10 7:53 ` Sudip Mukherjee
2015-05-12 20:43 ` Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 08/33] staging: rtl8192e: Remove RTLLIB_ERROR() and RTLLIB_WARNING() Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 09/33] staging: rtl8192e: Remove RTLLIB_DEBUG_WX() Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 10/33] staging: rtl8192e: Simplify rtllib_proces_probe_response() Mateusz Kulikowski
2015-05-09 21:18 ` [PATCH v3 11/33] staging: rtl8192e: Remove RTLLIB_DEBUG_SCAN() Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 12/33] staging: rtl8192e: Remove RTLLIB_DEBUG_(FRAG|EAP|DROP|STATE|TX|RX)() Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 13/33] staging: rtl8192e: Remove RTLLIB_DEBUG_QOS() Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 14/33] staging: rtl8192e: Remove RTLLIB_DEBUG_MGMT() Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 15/33] staging: rtl8192e: Remove RTLLIB_DEBUG_INFO() Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 16/33] staging: rtl8192e: Remove RTLLIB_DEBUG() Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 17/33] staging: rtl8192e: Remove RTLLIB_DEBUG_DATA() Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 18/33] staging: rtl8192e: Remove remains of RTLLIB_*_DEBUG() (including proc entry) Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 19/33] staging: rtl8192e: Remove assert() macro Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 20/33] staging: rtl8192e: Fix PREFER_PR_LEVEL warnings Mateusz Kulikowski
2015-05-09 22:37 ` Joe Perches
2015-05-12 20:20 ` Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 21/33] staging: rtl8192e: Fix LONG_LINE warnings Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 22/33] staging: rtl8192e: Fix LONG_LING in rtllib_parse_info_param() Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 23/33] staging: rtl8192e: Remove unimplemented iwpriv handlers Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 24/33] staging: rtl8192e: Fix OOM_MESSAGE warnings Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 25/33] staging: rtl8192e: Remove unused rtl_crypto.h Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 26/33] staging: rtl8192e: Replace ?: with max_t Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 27/33] staging: rtl8192e: Replace ?: with min_t Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 28/33] staging: rtl8192e: Replace ?: with max Mateusz Kulikowski
2015-05-11 13:22 ` Dan Carpenter
2015-05-12 20:08 ` Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 29/33] staging: rtl8192e: Remove unneeded RT_TRACE(COMP_ERR,...) Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 30/33] staging: rtl8192e: rtl8192_phy_checkBBAndRF(): Don't check MAC Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 31/33] staging: rtl8192e: Replace RT_TRACE(COMP_ERR, ...) with netdev_* Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 32/33] staging: rtl8192e: Fix trivial LONG_LINE errors Mateusz Kulikowski
2015-05-09 21:19 ` [PATCH v3 33/33] staging: rtl8192e: rtl8192E_suspend(): Fix WOL reporting Mateusz Kulikowski
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=20150518090918.GG22558@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mateusz.kulikowski@gmail.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