Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753356AbbDNIAe (ORCPT ); Tue, 14 Apr 2015 04:00:34 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:29853 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447AbbDNIA1 (ORCPT ); Tue, 14 Apr 2015 04:00:27 -0400 Date: Tue, 14 Apr 2015 11:00:11 +0300 From: Dan Carpenter To: Mateusz Kulikowski Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 10/21] staging: rtl8192e: replace memcpy() -> ether_addr_copy_unaligned() Message-ID: <20150414080011.GD10964@mwanda> References: <1428961664-4241-1-git-send-email-mateusz.kulikowski@gmail.com> <1428961664-4241-11-git-send-email-mateusz.kulikowski@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1428961664-4241-11-git-send-email-mateusz.kulikowski@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1190 Lines: 27 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 -- 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/