Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751658AbbEIW3g (ORCPT ); Sat, 9 May 2015 18:29:36 -0400 Received: from smtprelay0172.hostedemail.com ([216.40.44.172]:45093 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751081AbbEIW3f (ORCPT ); Sat, 9 May 2015 18:29:35 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:4321:5007:6261:8660:10004:10400:10848:11026:11232:11657:11658:11914:12043:12296:12438:12517:12519:12740:13069:13148:13230:13255:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: hook55_5366d4c29752c X-Filterd-Recvd-Size: 2633 Message-ID: <1431210572.22450.78.camel@perches.com> Subject: Re: [PATCH v3 01/33] staging: rtl8192e: Declare ethernet addresses as __aligned(2) From: Joe Perches To: Mateusz Kulikowski Cc: gregkh@linuxfoundation.org, dan.carpenter@oracle.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Sat, 09 May 2015 15:29:32 -0700 In-Reply-To: <1431206361-13736-2-git-send-email-mateusz.kulikowski@gmail.com> References: <1431206361-13736-1-git-send-email-mateusz.kulikowski@gmail.com> <1431206361-13736-2-git-send-email-mateusz.kulikowski@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1851 Lines: 45 On Sat, 2015-05-09 at 23:18 +0200, Mateusz Kulikowski wrote: > Add __aligned(2) into ethernet addresses allocated on stack or in non-packed > structures. Use ETH_ALEN as array length in places where it was hardcoded to 6. [] > diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c [] > @@ -321,7 +321,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) > u8 ICVer8192, ICVer8256; > u16 i, usValue, IC_Version; > u16 EEPROMId; > - u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x01}; > + u8 bMac_Tmp_Addr[ETH_ALEN] __aligned(2) = {0x00, 0xe0, 0x4c, > + 0x00, 0x00, 0x01}; While this is safe, as this follows a u16, it's unnecessary. Also, ideally, this would be u8 foo[ETH_ALEN] = { 1, 2, 3, 4, 5, 6 }; or just left on a single line. > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c [] > @@ -2573,8 +2573,9 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) > int ret = -1; > struct rtllib_device *ieee = priv->rtllib; > u32 key[4]; > - u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; > - u8 zero_addr[6] = {0}; > + u8 broadcast_addr[ETH_ALEN] __aligned(2) = {0xff, 0xff, 0xff, > + 0xff, 0xff, 0xff}; > + u8 zero_addr[ETH_ALEN] __aligned(2) = {0}; If these are used only in tests, these are probably better being removed and using is__ether_addr or maybe if these used in things other than tests, being converted to static const so they are not reinitialized on each call of the function. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/