From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752165AbbJKRXi (ORCPT ); Sun, 11 Oct 2015 13:23:38 -0400 Received: from smtprelay0181.hostedemail.com ([216.40.44.181]:44562 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751369AbbJKRXg (ORCPT ); Sun, 11 Oct 2015 13:23:36 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:1801:2198:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3871:4321:4605:5007:6261:6742:8603:8957:9121:10004:10400:10848:11026:11232:11233:11658:11914:12296:12438:12517:12519:12740:13069:13311:13357:14581:21080:30003:30054:30064:30091,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,LFtime:1,LUA_SUMMARY:none X-HE-Tag: park58_1edf379c35b03 X-Filterd-Recvd-Size: 2224 Message-ID: <1444584211.8012.25.camel@perches.com> Subject: Re: [PATCH 2/4] Staging: rtl8712: Use ether_addr_equal() over memcmp() From: Joe Perches To: punit vara Cc: kbuild test robot , kbuild-all@01.org, Larry Finger , Dogukan Ergun , Florian Schilhabel , Joshua Clayton , Greg KH , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Julia Lawall , Sudip Mukherjee , Dan Carpenter Date: Sun, 11 Oct 2015 10:23:31 -0700 In-Reply-To: References: <1444496322-3648-3-git-send-email-punitvara@gmail.com> <201510110819.TbhmLPRg%fengguang.wu@intel.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 On Sun, 2015-10-11 at 16:42 +0530, punit vara wrote: > following are the two structure need to be consider for alignment. > > struct iw_pmksa { > __u32 cmd; /* 0 4 */ > struct sockaddr bssid; /* 4 16 */ > __u8 pmkid[16]; /* 20 16 */ wrong bssid, bssid here is on the stack after a char *, so bssid is aligned on a pointer boundary, either 4 or 8. > /* size: 36, cachelines: 1, members: 3 */ > /* last cacheline: 36 bytes */ > }; > > struct wlan_bssid_ex { [] > unsigned char MacAddress[6]; /* 4 6 */ > As I understood both are not aligned to u16 so > ether_addr_equal_unaligned() should be used. u16s are aligned when on any even address So ether_addr_equal could be used.