lkml.org 
[lkml]   [2015]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 10/21] staging: rtl8192e: replace memcpy() -> ether_addr_copy_unaligned()
On Mon, Apr 13, 2015 at 11:47:33PM +0200, Mateusz Kulikowski wrote:
> rtl8192e driver uses memcpy() to copy hw addresses in several places.
> checkpatch.pl suggests to use ether_addr_copy(), but most of
> addresses in driver may be unaligned.

The pointer to the struct is normally aligned (or you are in trouble
anyway and can't use it like a normal pointer). Then you can calculate
the alignment of the struct member by looking at the struct.

BAReq->addr1 is part of struct rtllib_hdr_2addr. It's 4 bytes into
the struct so it's fine.

I sort of like the ether_addr_copy_unaligned() macro because it would
let us silence some checkpatch false positives because otherwise people
will eventually introduce bugs like a dripping roof leak will eventually
destroy a building. But it should be in the main kernel header with a
name like that. And also this is misleading that we are using it for
data which is aligned.

regards,
dan carpenter



\
 
 \ /
  Last update: 2015-04-14 10:41    [W:0.450 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site